On 24 Mar, Sara wrote:
> What If I want to remove dupes from @row? like if $row[2] is similar in
> multiple records,
> only one entry should be showed, the duplicates should not appear in the
> print.
> Any ideas?
#! /usr/bin/perl
use strict;
use warnings;
{
local $" = "\n";
my (@dupes, %have);
@dupes = qw(hello hello goodbye goodbye);
for (my $i = $#dupes; $i >= 0; $i--) {
splice(@dupes, $i, 1) if $have{$dupes[$i]};
$have{$dupes[$i]} = 1;
};
print "@dupes\n";
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>