#!/usr/bin/perl -wl use strict; my @db = qw(aaa bbb ccc ddd eee fff); my @in = qw(aaa fff); my %h; # Initialise the hash using a slice @h{@in} = undef; print "@db"; @db = grep {not exists $h{$_}} @db; print "@db"; __END__ Prints: aaa bbb ccc ddd eee fff bbb ccc ddd eee
--
John.
In reply to Re: deleting elements of one array from another
by jmcnamara
in thread deleting elements of one array from another
by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |