in reply to Converting fixed record length files to pipe delimited

I'd do it something like this (trying to reconstruct the spec by reverse engineering your script):

open(INFILE, $file) or die "Can't open $file: $!\n"; open(OUTFILE, $file) or die "Can't open $outfile: $!\n"; # widths of the cols my @cols = qw(3 50 7 7 7 7 6 6 6 6 55 4 41 6 23 7 169); # build unpack format my $fmt = join '', map { "A$_" } @cols; # column names my @col_names = qw(mfg model spec1 spec2 spec3 spec4 opt1 opt2 opt3 opt4 desc qoh trash1 mult trash2 list trash3); while (<INFILE>) { my %rec; $rec{@col_names} = unpack $fmt, $_; next if $rec{model} = 'COMPONENT PARTS'; print OUTFILE join('|', $rec{@col_names}) }

Which looks a bit simpler than your version :)

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me