from the perl FAQ:
@array1 = (1..10);
@array2 = (5..15);
@union = @intersection = @difference = ();
%count = ();
foreach $element (@array1, @array2) {
$count{$element}++ }
foreach $element (keys %count) {
push @union, $element;
push @{ $count{$element} > 1 ? \@intersection
: \@difference }, $element;
}
mike
-----Original Message-----
From: Nisim, Amit [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 02, 2002 2:07 PM
To: [EMAIL PROTECTED]
Subject: compare between two arrays
Hi All,
I want to compare between two arrays.
How can I do it ?
One way I know is :
$a = (join " ",@a);
$b = (join " ",@b);
if ($b eq $a) { print "equal";}
I am looking for better way.
thanks
amit
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]