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 -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/