On Mar 8, 2004, at 1:37 PM, James Edward Gray II wrote:

my @words = qw(dog cat dog lizard dog wombat dog);
my %seen;
foreach (@words) {
        $seen{$_}++;
}
my @words = keys %seen;

Egad, I'm dumb today, drop the my in the above line. Sorry.


print "@words\n"; # only prints one dog

James



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




Reply via email to