in reply to Re: Extreme Example of TMTOWTDI
in thread Extreme Example of TMTOWTDI
Change$ 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
intopush @{$Word{length$_}},$_ while (<>); # ... print OUT @{$Word{$_}};
$Word{length$_} .= $_ while (<>); # ... print OUT $Word{$_};
update (2)#!/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; };
_ _ _ _ (_|| | |(_|>< _|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: (FASTER) Example of TMTOWTDI
by demerphq (Chancellor) on Mar 22, 2002 at 11:53 UTC |