in reply to Comparing strings
@union = @intersection = @difference = (); %count = (); foreach $element (@a, @b) { $count{$element}++ } foreach $element (keys %count) { push @union, $element; push @{ $count{$element} > 1 ? \@intersection : \@difference } +, $element; } foreach $int (@difference){ if ($int ne " "){ @fname = split(/ /, $int); print "\n difference elements --> $fname[0]\n"; } }
Edited by planetscape - added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparing strings
by tanyeun (Sexton) on Jul 25, 2006 at 00:55 UTC |