my @nc; my %seen; while (<$fh>) { chomp; push @nc, $_ if !$seen{$_}++; }
Or if your input is guaranteed to be sorted,
my @nc; my $last; while (<$fh>) { chomp; push @nc, $last = $_ if !defined($last) || $last ne $_; }
In reply to Re: Capturing Unique Data
by ikegami
in thread Capturing Unique Data
by donkost
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |