in reply to Sorting and Arranging data from input file

What have you tried? What is not working? See How do I post a question effectively?.
  • Comment on Re: Sorting and Arranging data from input file

Replies are listed 'Best First'.
Re^2: Sorting and Arranging data from input file
by Homerhrdz (Initiate) on Jun 11, 2010 at 14:36 UTC
    This is what i have tried
    #!/usr/bin/perl my $inFile = "input file"; my $outFile = "output file"; open IN, "< $inFile"; open OUT, ">> $outFile"; my @not_sorted = <IN>; print OUT "|CSED Form|OrderNumber|Date|Total Documents|Total Pages|\n +"; @sorted = sort { lc($a) cmp lc($b) } @not_sorted; # alphabetic +al 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;
      warnings would have pointed you to a bug in your code: you never assign a value to $form.

      Other suggestions: