foreach $e (@a) { $union{$e} = 1 }
foreach $e (@b) {
if ( $union{$e} ) { $isect{$e} = 1 }
$union{$e} = 1;
}
@union = keys %union;
@isect = keys %isect;
|
< Embrace Hashes Or > Table of Contents | Page 13 |
YAPC 19101,
June 2001 Perl Idioms Nathan Torkington |