R. Joseph Newton wrote:

Although it is not necessary the meaning might be better expressed:
my $n = (@$a > @$b ? @$a : @$b)


Sorry for jumping in -

You cannot compare two arrays that way and expect them to be numerically different - if they are it may be a coincidence; consider for discussion:


#! C:\perl\bin\perl.exe -w #! /usr/bin/perl -w

use strict;

my @aarray=('Start test','Stop test');
my @barray=('ABCDE 1234','T123 S456');

my $sanity = (1 > 2) ? "greater" : "lesser";
print "Sanity states: $sanity\n\n";

my $test = (@aarray > @barray) ? ++$#aarray
                               : ++$#barray;

print "Test1 'size' found $test \n\n";

my $test2 = (@barray > @aarray) ? ++$#aarray
                               : ++$#barray;

print "Test2 'size' found $test2 \n\n";

(@aarray <=> @barray) ? print "Array B greater\n"
                      : print "They are numerically equal\n\n";

(@aarray cmp @barray) ? print "Array B is bigger\n"
                      : print "They are Equal Strings\n\n";

__END__

test ? true(1) : false(0);

Comparison
<=> cmp    0 if equal, 1 if $a greater, -1 if $b greater

You prolly really meant this:
        @a = @b ? @b : @c;

See also -
perl -le '$a = NaN; print "No NaN support here" if $a == $a'
perl -le '$a = NaN; print "NaN support here" if $a != $a'


What you probably want is to compare $#array (array size) or to loop thru each array and test every element (is aarray[1] eq barray[1].)


-Bill-
__Sx__________________________________________
http://youve-reached-the.endoftheinternet.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to