in reply to largest number inside array/hash
Hi Anonymous Monk.
In an attempt to display the 'syntactically rich' nature of the perl language, I have taken the liberty of including yet another array oriented solution:
Output:
C:\>
Hope this helps,
-Katie
In an attempt to display the 'syntactically rich' nature of the perl language, I have taken the liberty of including yet another array oriented solution:
#!/usr/bin/perl -w use strict; my @array = ( 33, 56, 3, 2, 67, 101, 218, 4, 17 ); my @nums = sort { $a <=> $b } @array; print "The largest number is: $nums[$#nums]\n";
Output:
C:\>perl pg8.pl The largest number is: 218
C:\>
Hope this helps,
-Katie
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: largest number inside array/hash
by TomDLux (Vicar) on Apr 07, 2004 at 07:35 UTC | |
by tilly (Archbishop) on Apr 08, 2004 at 05:31 UTC | |
Re^2: largest number inside array/hash
by Anonymous Monk on Aug 17, 2012 at 17:09 UTC |
In Section
Seekers of Perl Wisdom