On Jan 2, John W. Krahn said:
>> I want to compare between two arrays.
>> $a = (join " ",@a);
>> $b = (join " ",@b);
>> if ($b eq $a) { print "equal";}
>
>Well you _can_ do this in one line. :-)
>
>$ perl -le'@a = qw(one two three four); @b = qw(one two three four);
>print "equal" if "@a" eq "@b"; '
>equal
But this still returns a false positive on the arrays
@a = ("a b", "c");
@b = ("a", "b", "c");
To avoid that, you have to find a character (or character sequence) not
used in the elements of the arrays. That takes far too long.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]