Mathew Snyder wrote:
The way I would do it is to place the initial data instance into a hash if it
doesn't already exist.

Just do a next if it does.

It will remove duplicate key, not line.

my %hash=();

while (<>) {
  chomp;
  my ($key, $val) = split /,/;
  $hash{$key} = $val;
}

while ( my ($key, $value) = each(%h) ) {
  print "$key => $value\n";
}


Thanks.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to