in reply to text file validation

Well, you've been told how to print the first (up to) 160 characters of each line, and eventually how to print the first (up to) 160 characters of the entire file ... but I figured you might also want to know how to stop reading after having read the first (up to) 160 characters of the file, provided your "characters" are "bytes".

my $read = do { local $/ = \160; # set record size open my $fh, '<', $filename or die "Could not open $filename: '$!'"; <$fh>; # scalar context, so the first record only }; # now print $read or whatever

See $/.

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!