in reply to Re^3: Sort then conditionally sort
in thread Sort then conditionally sort

Thanks Kyle, but How would this be adapted to read in a file and out put to another/

Replies are listed 'Best First'.
Re^5: Sort then conditionally sort
by kyle (Abbot) on Apr 10, 2009 at 16:56 UTC

    Have a look at open and print. This code does nothing but copy an input file to the output file to show their use. For your application, you'll want to do a lot more "stuff" between the reading and writing.

    my $in_filename = 'in.txt'; my $out_filename = 'out.txt'; open my $in_fh, '<', $in_filename or die "Can't read '$in_filename': $!"; open my $out_fh, '>', $out_filename or die "Can't write '$out_filename': $!"; while ( my $in_line = <$in_fh> ) { print {$out_fh} $in_line; } close $in_fh or die "close failed: $!"; close $out_fh or die "Close failed: $!";
      thank you Kyle , I will try to adapt to the other code you made....wish me luck.... thank you for all your help