my %h; for(qw/foo bar baz quux foo narf bar poit/) { $h{$_} = 1; } #### my (%h, @a); for(qw/foo bar baz quux foo narf bar poit/) { push @a, $_ unless exists $h{$_}; $h{$_} = 1; }