#!/usr/bin/perl use strict; use warnings; my $string="012345678901234567890" print substr($string,0,16); #### #!/usr/bin/perl use strict; use warnings; open(FILE,"yourfilenamehere.txt") or die "Could not open file $!\n"; # open yourfilenamehere.txt for reading while(){ #read yourfilenamehere.txt a line at a time chomp; print "\n" . substr($_,0,160); #as described above, except print first 160 characters only } close FILE #close filehandle