in reply to Keeping order, no duplicate and the complete keyset

I did it myself before peeking at the above answers, and came up with something that avoids grep and seems pretty concise to me, here it is:
use strict; use warnings; my @big = qw(a b c d e f g h i); my @small = qw(f c d g); my %small; $small{$_}=1 for @small; my @keys_wanted = @small; foreach ( @big ) { push @keys_wanted, $_ unless $small{$_}; } print "@keys_wanted";
This doesn't remove dupes though (see ikegami's comments above), and I'm not sure if it can be simply modified to do so.