in reply to Bitwise & not working correctly in CGI script
print "19 & 16 = ", (19 & 16), "\n"; print "'19' & '16' = ", ('19' & '16'), "\n"; print "'19' & 16 = ", ('19' & 16), "\n"; print "19 & '16' = ", (19 & '16'), "\n";
The thing is that Perl did not convert the string (keys of a hash are ALWAYS strings, even if you used numeric literals when filling it in.) to a number and instead it evaluated a bitwise AND on the characters of the strings.
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bitwise & not working correctly in CGI script
by Anonymous Monk on Jun 14, 2012 at 06:28 UTC | |
|
Re^2: Bitwise & not working correctly in CGI script
by solegaonkar (Beadle) on Jun 15, 2012 at 08:28 UTC |