$ wc words.english
116246 116246 989075 words.english
$ time perl dict.pl words.english # first hack
1.38 user
0.05 system
0:01.43 elapsed
$ time perl dict2.pl words.english # second hack
0.86 user
0.02 system
0:00.88 elapsed
####
push @{$Word{length$_}},$_ while (<>);
# ...
print OUT @{$Word{$_}};
##
##
$Word{length$_} .= $_ while (<>);
# ...
print OUT $Word{$_};
##
##
#!/usr/bin/perl -w
use strict;
my @words;
my $file;
$words[length$_] .= $_ while (<>);
for (0..$#words)
{
next unless $words[$_];
$file=$_-1 . ".mine";
open OUT,">$file" or die "Cannot open $file.mine: $!\n";
print OUT $words[$_];
close OUT;
};