in reply to re-opening DATA, printing any character

<nl>
  • seek(DATA,0,0). Not a re-open, just roll back to the begining. Hmmm... actually, that puts you at the top of the script. You should save the starting point first:
    $startOfData= tell DATA; while( <DATA> ) { ProcessData( $_ ); } seek( DATA, $startOfData, 0 ) or die "Can't seek: $!"; while( <DATA> ) { ReprocessedCheese( $_ ); }
  • Lots of modules for this. dumpvar.pl, DumpVar, Data::Dumper, etc. But you can roll your own pretty quick and not feel bad about using one of these modules that knows about so much more than dumping strings:
    ( $text= $binary ) =~ s#([^ -~])# sprintf "\\x%02.2x",unpack("C",$1) #ge; print "$text\n";
    There are lots of variations here. But my favorite way is just to use the x command in the Perl debugger. </nl>