Hi Marek,
certainly you got this as exercise to learn the language than to solve
the Problem. So it's probably not intended to just use a module, but
somewhat should at least mention it:
A short and nice solution is also:
#!/usr/bin/perl
use strict;
use warnings;
use List::Util qw/max/;
my @array = (42,41,42,31,54,42,56,57,46,58,59,60,34,61);
print "Max of @array is: ", max(@array);
As usual, there is more than way to do it.
Greetings,
Janek
certainly you got this as exercise to learn the language than to solve
the Problem. So it's probably not intended to just use a module, but
somewhat should at least mention it:
A short and nice solution is also:
#!/usr/bin/perl
use strict;
use warnings;
use List::Util qw/max/;
my @array = (42,41,42,31,54,42,56,57,46,58,59,60,34,61);
print "Max of @array is: ", max(@array);
As usual, there is more than way to do it.
Greetings,
Janek
Aucun commentaire:
Enregistrer un commentaire