in reply to Parsing Large files
Well, here's my solution:
use strict; use warnings; use 5.010; open my $dfd, '<', '/usr/share/dict/british-english' or die $!; my %dict; while (<$dfd>) { next unless /^[a-z]+$/; push @{$dict{hash($_)}}, $_; } close $dfd; while (<>) { exit if /^$/; say join '', @{$dict{hash($_)}} if $dict{hash($_)}; } sub hash { join '', sort split //, shift; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing Large files
by hodge-podge (Novice) on Apr 30, 2010 at 19:09 UTC | |
by ikegami (Patriarch) on Apr 30, 2010 at 20:53 UTC |