in reply to Why does this hash remove duplicate lines
an interesting technique but all it amounts to is testing for the existence of a hash element, which can also be done (perhaps more intuitively) thus:
my %lines; while (<DATA>) { unless (exists($lines{$_})) {print "$_"} $hash{$_}="done"; # element defined }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why does this hash remove duplicate lines
by olus (Curate) on Mar 06, 2008 at 11:38 UTC |