in reply to De-Duping An Array

@saw{ @arr } = (); is a hash slice assignment. The following three snippets are functionally equivalent:

@saw{ qw( a b c ) } = ( 1, 2, 3 );
( $saw{a}, $saw{b}, $saw{c} ) = ( 1, 2, 3 );
$saw{a} = 1; $saw{b} = 2; $saw{c} = 3;

Update: By the way, your solutions do not preserve the order of the items. If that was a requirement, you'd could use

my @arr = (4, 1, 6, 4, 3, 7); my %saw; my @new_arr = grep !$saw{$_}++, @arr; print @new_arr;

Replies are listed 'Best First'.
Re^2: De-Duping An Array
by SheridanCat (Pilgrim) on Dec 21, 2006 at 22:02 UTC
    Ah, thanks very much. Preserving order wasn't a requirement, but that's cool to know.