Re: Ternary operator question

2004-03-02 Thread WilliamGunther
In a message dated 3/2/2004 9:21:57 AM Eastern Standard Time, [EMAIL PROTECTED] writes: >$#array + 1 still is the size of the array and it won't modify the >array. That's not what we were talking about. We were talking about >++$#array, which expands to $#array = $#array + 1. Note the equal s

Re: Ternary operator question

2004-03-02 Thread James Edward Gray II
On Mar 2, 2004, at 12:41 AM, WC -Sx- Jones wrote: Once upon a time $#array + 1 was the size of the array; obviously (scalar @array) now has the right size. $#array + 1 still is the size of the array and it won't modify the array. That's not what we were talking about. We were talking about ++

Re: Ternary operator question

2004-03-01 Thread WC -Sx- Jones
John W. Krahn wrote: You do realise that ++$#array modifies @array? $ perl -le' @array = 90 .. 99; print scalar @array; ++$#array; print scalar @array; ++$#array; print scalar @array; ' 10 11 12 D'Oh! Yep, it does... Once upon a time $#array + 1 was the size of the array; obviously (scalar @ar

Re: Ternary operator question

2004-03-01 Thread John W. Krahn
Wc -Sx- Jones wrote: > > R. Joseph Newton wrote: > > > print "Greater count was $greater_count\n"; > > print "Lesser count was $lesser_count\n"; > > But that was my point - you could just use ++$#array; because you are > only testing sizeOf array - a true test would be to see if they are > ident

Re: Ternary operator question

2004-03-01 Thread Daniel T. Staal
--As of Monday, March 1, 2004 8:54 PM -0500, WC -Sx- Jones is alleged to have said: But that was my point - you could just use ++$#array; because you are only testing sizeOf array - a true test would be to see if they are identical in what each array holds. --As for the rest, it is mine. Only if

Re: Ternary operator question

2004-03-01 Thread WC -Sx- Jones
R. Joseph Newton wrote: print "Greater count was $greater_count\n"; print "Lesser count was $lesser_count\n"; But that was my point - you could just use ++$#array; because you are only testing sizeOf array - a true test would be to see if they are identical in what each array holds. -Bill- __

Re: Ternary operator question

2004-03-01 Thread R. Joseph Newton
WC -Sx- Jones wrote: > 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 - No problem. That's why this is a group. > You cannot compare two arrays that way and expect them to be numerica

Re: Ternary operator question

2004-03-01 Thread WC -Sx- Jones
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:

Re: Ternary operator question

2004-03-01 Thread R. Joseph Newton
Andrew Gaffney wrote: > Perl wrote: > > I am trying to understand how this works. For example: > > > > my $n = @$a > @$b ? @$a : @$b; > > > > > > I understand this is a conditional statement I am just not sure what is > > being compared with ? and :. > > I believe that the above just assigns a tru

Re: Ternary operator question

2004-02-29 Thread John W. Krahn
Andrew Gaffney wrote: > > Perl wrote: > > I am trying to understand how this works. For example: > > > > my $n = @$a > @$b ? @$a : @$b; > > > > I understand this is a conditional statement I am just not sure what is > > being compared with ? and :. > > I believe that the above just assigns a true

Re: Ternary operator question

2004-02-29 Thread John W. Krahn
Perl wrote: > > I am trying to understand how this works. For example: > > my $n = @$a > @$b ? @$a : @$b; > > I understand this is a conditional statement I am just not sure what is > being compared with ? and :. That is same as: my $n; if ( @$a > @$b ) { $n = @$a; } else { $n = @$

Re: Ternary operator question

2004-02-29 Thread Andrew Gaffney
Perl wrote: I am trying to understand how this works. For example: my $n = @$a > @$b ? @$a : @$b; I understand this is a conditional statement I am just not sure what is being compared with ? and :. I believe that the above just assigns a true or false (1 or 0) to $n. The statement is the same

Ternary operator question

2004-02-29 Thread Perl
I am trying to understand how this works. For example: my $n = @$a > @$b ? @$a : @$b; I understand this is a conditional statement I am just not sure what is being compared with ? and :. --Paul