foreach (@A) { $seenA{$_} = 1 }; foreach (@B) { $seenB{$_} = 1 }; foreach (keys %seenA) { if ( exists $seenB{$_} ) { push @both, $_; } else { push @Aonly, $_; } foreach (keys %seenB) { push @Bonly, $_ unless exists $seenA{$_}; }
Previous | Back to start of show | Next |
Slide: 33 cookbook | © 2003 James E. Keenan |