Eradicatore has asked for the wisdom of the Perl Monks concerning the following question:
But that outputs:#!/usr/local/bin/perl -w use strict; my $key = "24" & "4"; print "Key: $key\n"; my $key2 = "2f" & "4"; print "Key2: $key2\n"; my $key3 = "24" & "04"; print "Key3: $key3\n";
Key: 0
Key2: 0
Key3: 04
So really only the last case works. It says right in the camel book that it should assume the string is padded with zeros if one string is longer than the other. Also, why on earth can I not use hex digits in this type of operation?
I guess I'm just really frustrated by perls bitwise funcitonality right now. It sure seems difficult to deal with things as bits to me. Anyone know of a good tutorial on this type of thing?
Justin Eltoft
"If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: bitwise operators
by bikeNomad (Priest) on Jul 18, 2001 at 19:28 UTC | |
|
Re: bitwise operators
by RatArsed (Monk) on Jul 18, 2001 at 19:10 UTC | |
by Eradicatore (Monk) on Jul 18, 2001 at 19:18 UTC | |
by RatArsed (Monk) on Jul 18, 2001 at 22:55 UTC | |
|
Re: bitwise operators
by petral (Curate) on Jul 19, 2001 at 06:18 UTC |