in reply to Problems using pack
You should get the same results. Now, try a file (remove the -l option of perl, as it inserts a new line):$g = "0110110001101101"; $bob = pack("B*", $g); print $g . "\n"; print unpack("B*", $bob);
And report the results (note, I changed the bytes to be visible, now it should print "lm")open(FH, ">fh"); $g = "0110110001101101"; $bob = pack("B*", $g); print FH $bob; close(FH); open(FH, "fh"); read(FH, $from_file, 2); print $g . "\n"; print unpack("B*", $from_file), "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Problems using pack
by Anonymous Monk on Aug 19, 2002 at 07:04 UTC |