in reply to bitwise operators
You probably use variables, so you have to make sure Perl thinks they contain only numbers, and not strings. If you populate your variables by reading it from file, or by extracting it with a regex, Perl thinks the variables are strings. You can numify them by adding 0s:print 161 & 255; # Prints 161 print "161" & "255"; # Prints 041
print +("161" + 0) & ("255" + 0); # Prints 161
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: bitwise operators
by bart (Canon) on Jan 19, 2005 at 17:20 UTC | |
by Anonymous Monk on Jan 19, 2005 at 17:56 UTC |