in reply to Why, what, where to unpack?! (was: Files, unpack and text values)
in thread Files, unpack and text values
i'm not sure if it is correct to loop on a binary file handle like that, but it certainly doesn't make much sense to me: "for each line in this binary file" is a contradiction in terms, since binary files don't have any "lines".
i don't know why your hex editor breaks strings at that interval, but it seems a little narrow for you to store it that way. i would use 36 bytes per line with no spaces, myself.
the following code works fine for me. however, i would probably use MIME::Base64 to encode the data if it were my choice. plain hex is just a little too fat for my taste.
open IMG, "foo.gif" or die "Couldn't open image: $!\n"; undef $/; $image = <IMG>; print unpack("H*", $image); close IMG;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Why, what, where to unpack?! (was: Files, unpack and text values)
by BBQ (Curate) on Jun 26, 2000 at 07:13 UTC | |
by mdillon (Priest) on Jun 26, 2000 at 07:18 UTC |