in reply to script not working

You need to print the variable $fivefirstfile1, but you're printing the non-defined variable $fivefprot1.
If you're using string and warnings, you can catch it.

You might want to consider using something like this:
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";