@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
In reply to Re: Comparing strings
by mantra2006
in thread Comparing strings
by tanyeun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |