in reply to how to read in a binary file and convert it to ascii output
An old script of mine will do this:
YES! No strict, No warnings... As I said above: It's old! I was younger that time... And not a monk!#!/usr/bin/perl @fill= qw( .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ); if (scalar(@ARGV)) { foreach $file(@ARGV) { $size= -s $file; $form= length(sprintf("%x",$size))-1; ++$form unless $form; print "File: ",$file,"\n"; open (IN,$file); &dump(*IN, $form); close (IN) } } else { &dump(*STDIN, 4); } sub dump { local(*IN, $form)= @_; my ($buf, $i); while ($rb= read(IN, $buf, 16)) { @x= unpack("H2" x $rb, $buf); $buf=~ s/[\x00-\x1f\x7f-\xff]/./g; $buf.= ' ' x (16-length($buf)); printf ("%0${form}x0: %s [%s]\n" ,$i++, ,sprintf ("%s %s %s %s %s %s %s %s - %s %s %s %s %s +%s %s %s", @x, @fill) ,$buf ); } }
s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
In Section
Seekers of Perl Wisdom