Sort a file
#!/usr/bin/perl -w
use strict;
my $input = shift;
my $output = shift;
open(INPUT, '<', $input) or die "Couldn't open file $input: $!\n";
open(OUTPUT, '>', $output) or die "Couldn't open file $output: $!\n";
my @file = <INPUT>;
@file = sort @file;
print OUTPUT @file;
close INPUT;
close OUTPUT;
Related examples in the same category