Hi Chas. Owens,

Thanks a lot for the clarification. Finally I would like to understand how to find that the character \x{01} is getting printed. It is not visible onto the standard output display.

Thanks and Regards,
Rajanikanth

--
Rajanikanth
ASIC, Texas Instruments India
Phone : +91-80-25099116
Fax   : +91-80-25048213
Email : [EMAIL PROTECTED]



Chas. Owens wrote the following on 03/19/08 19:18:
On Wed, Mar 19, 2008 at 9:32 AM, Rajanikanth Dandamudi
<[EMAIL PROTECTED]> wrote:
Hi All,

 I would like to understand the behavior of the following program:
snip
 my @a=qw(1 0 0 0 0 0 0 1);
 my @b=qw(0 0 0 0 0 0 0 0);
snip
 I would like to understand why $f does not have any value in the first
 print statement. perl version being used is v5.8.0
snip

Because you are not using a numeric xor, you are using an string xor.
The qw// operator returns a list of strings:

my @a = ('1', '0', '0', '0', '0', '0', '0', '1');

You might want to read up on bitwise string operators*, in the
meantime, I would suggest not using qw// when you are dealing with
numeric values or ensure that your values are numeric by adding 0 to
them before using an operator that has both numeric and string
versions.  By the way, a value is being printed, you just can't see it
because it is character \x{01} (start of heading).

* http://perldoc.perl.org/perlop.html#Bitwise-String-Operators

Reply via email to