my @columns = ( [ 0 , 9 ], # position,width [ 13, 14], # ... ); while( <$the_file> ){ chomp; my @data = (); for my $spec ( @columns ){ push @data , substr($_,@$spec) } print join('|',@data),"\n"; }