ravishi has asked for the wisdom of the Perl Monks concerning the following question:
What I want in this example is an end output of 0. I get 4294967295 with an error saying "Argument "00008008000000FF00800000" isn't numeric in bitwise and (&) at .... line 16. Do I have to typecast the array to be an int? I thought you didn't have to do that. Please advise.
#!/usr/bin/perl -w # File displayPipeTracer2.pl $testString = " 00008008 000000FF 00800000"; print "Original: $testString\n"; $testString =~ s/^\s+//; #remove leading spaces $testString =~ s/\s+$//; #remove trailing spaces print "Removed L/T: $testString\n"; $testString =~ s/\s//g; print "Removed ws: $testString\n"; $maskResult = $testString & 400000000000000000000000; print "Mask Result: $maskResult\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bitwise Operator Error
by ikegami (Patriarch) on Oct 02, 2008 at 19:13 UTC | |
by ravishi (Acolyte) on Oct 03, 2008 at 13:35 UTC | |
by ikegami (Patriarch) on Oct 03, 2008 at 19:53 UTC | |
|
Re: Bitwise Operator Error
by almut (Canon) on Oct 02, 2008 at 21:46 UTC | |
|
Re: Bitwise Operator Error
by XooR (Beadle) on Oct 02, 2008 at 19:29 UTC | |
|
Re: Bitwise Operator Error
by jethro (Monsignor) on Oct 02, 2008 at 19:21 UTC | |
|
Re: Bitwise Operator Error
by broomduster (Priest) on Oct 02, 2008 at 18:49 UTC | |
by ikegami (Patriarch) on Oct 02, 2008 at 19:18 UTC | |
by ravishi (Acolyte) on Oct 02, 2008 at 19:05 UTC |