On 6/6/05, Nischi wrote:
> Hello
> i am having something like this ...
>
> $b = "\xa0\xa0\xa0\x{100}" =~ /(\xa0+)/;
Try not to use "$b" (or "$a") as variable names. "$a" and "$b" are the
special Perl sort variables and using them can cause strange bugs, for
example because even under "use strict" you can use "$b" without
declaring it.
> $b =~ \(\xa0+)\;
What is this line supposed to do? This does not compile...
> print "Valid" if ($1 eq "\xa0\xa0\xa0";
You are missing a ")" before the ";" at the end. Again, this is a
compile-time error.
> print " $b $1";
>
> Here according to the regular expression the $1 should contain the matching
> string. so
> according $1 should have \xa0\xa0\xa0. This is happening in ASCII platform
> but it is not
> working in the EBCIDIC.
>
> as x{100} is 2 byte character, \xa0 will also get converted to double byte
> which is valid.
> The strange thing is in $1 \xa0 is 4 bytes.
>
> Why is that $1 is containing 4 bytes, why data is not correct.
>
> PS: all these is happening only in EBCIDIC platform. in ASCII it is fine.
>
As I don't have access to an EBCIDIC platform, I can't check this.
However this should work:
use strict;
use warnings;
my $bb = "\xa0\xa0\xa0\x{100}" =~ /(\xa0+)/;
print "Valid\n" if ($1 eq "\xa0\xa0\xa0");
print "$bb $1\n";
HTH,
--
Offer Kaye
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>