open IMG, "foo.gif" or die "Couldn't open image: $!\n"; binmode(IMG); undef $/; $image = ; $hex = unpack("H*", $image); close IMG; while ($txt = substr($hex,0,32,'')) { print "'$txt'\n"; }