Ron Smith wrote:
> --- "John W. Krahn" <[EMAIL PROTECTED]> wrote:
>>
>>But since you are sorting numbers, you probably want
>>to do a numeric sort to
>>get the correct numbers:
>>
>>my ( $smallestNum, $largestNum ) = sort { $a <=> $b
>>} @numbers;
>>
> I'm using: my @sorted = sort { $a <=> $b } @numbers;

Sorry, my mistake, that should really be:

my ( $smallestNum, $largestNum ) = ( sort { $a <=> $b } @numbers )[ 0, -1 ];

Although as I said, the for loop is more efficient.



John
-- 
use Perl;
program
fulfillment

-- 
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