View Single Post
  #2 (permalink)  
Old April 22nd, 2006, 06:21 AM
ciderpunx ciderpunx is offline
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What does the following code do and why does it work (assume the arrays @A and @B exist):

my %s;
my @answer;

@s{@B} = ();

for (@A) { push(@answer, $_) unless exists $s{$item}; }

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com
Reply With Quote