in reply to Keeping order, no duplicate and the complete keyset
One way
perl> @big = qw(a b c d e f g h i);; perl> @small = qw(f c d g);; perl> undef @found{ @small };; perl> @wanted = ( @small, grep{ !exists $found{ $_ } } @big );; perl> print @wanted;; f c d g a b e h i
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Keeping order, no duplicate and the complete keyset
by ikegami (Patriarch) on Dec 07, 2005 at 22:46 UTC | |
by BrowserUk (Patriarch) on Dec 08, 2005 at 06:10 UTC |