Tanaka has asked for the wisdom of the Perl Monks concerning the following question:
Then I read the data back from the file and unpack it thus:$bob=pack("B*",11101100); print DATAFILE $bob;
And they are equal, yes! So I then tried to write two bytes (which should be two characters in ASCII, or perhaps one if you use a unicode interpretation (which I eventually will)).$bobagain=unpack("B*",$stufffromfile); $bobunpacked=unpack("B*",$bob); print $bobagain; print "\n$bobunpacked";
and then did the same thing:$bob = pack("B*",1110110010010000); print DATAFILE $bob;
But they are not equal!$bobagain=unpack("B*",$stufffromfile); $bobunpacked=unpack("B*",$bob); print $bobagain; print "\n$bobunpacked";
and $bobunpacked isn't even what it should be! what is going on? I have absolutely no clue what is going on, can anyone help me with this?from file: 111000111000010010000111 from $bobunpacked: 101101100100111110000000
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Problems using pack
by tye (Sage) on Aug 19, 2002 at 05:11 UTC | |
|
Re: Problems using pack
by spurperl (Priest) on Aug 19, 2002 at 05:29 UTC | |
by Anonymous Monk on Aug 19, 2002 at 07:04 UTC | |
|
Re: Problems using pack
by JupiterCrash (Monk) on Aug 19, 2002 at 03:32 UTC | |
|
Re: Problems using pack
by BrowserUk (Patriarch) on Aug 19, 2002 at 08:53 UTC |