#!/usr/bin/perl my $inFile = "input file"; my $outFile = "output file"; open IN, "< $inFile"; open OUT, ">> $outFile"; my @not_sorted = ; print OUT "|CSED Form|OrderNumber|Date|Total Documents|Total Pages|\n"; @sorted = sort { lc($a) cmp lc($b) } @not_sorted; # alphabetical sort my $a = 0; while ($lstxt = pop @sorted) { $field[0] = $lstxt; $field[0] = substr $lstxt, 1, 3; $field[0] = $form; if ($form eq "M729") { print OUT "$lstxt"; $a++; } else { print OUT "There were $a Monthly 729 runs\n"; } $a = 0; if ($form eq "M737") { print OUT "$lstxt"; $a++; } else{ print OUT "there were $a Monthly 737 runs\n"; } $a = 0; if ($form eq "Q569") { print OUT "$lstxt"; } else{ print OUT "there were $a Quarterly 569 runs\n"; } } close OUT; close IN;