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
In Section
Seekers of Perl Wisdom