use strict; use warnings; my $file = $0; open(my $fh, '<', $0) or die "$file: $!"; my @lines = <$fh>; my $chars = substr($lines[7], 0, 5); print "Five first characters are: <$chars>\n";