in reply to Re^2: Finding target unspecified value
in thread Finding target unspecified value

Do this to use my idea:

... # add this line my $maxval = 0; foreach (@array) { $maxval = $_ if $_ > $maxval; # and populate as needed here print $_, "\t"; $counter ++; if ($counter % 4 == 0) { print "\n"; } } # then include the value in your final print statement print "The largest element is: $maxval\n";

On the other hand, to use max as shown by Rolf do this:

use strict; use List::Utils qw/max/; # add this line ... # rest of your code is unchanged # and then use the function in your final print statement print "The largest element is: " . max(@array) ."\n";
The answer to the question "Can we do this?" is always an emphatic "Yes!" Just give me enough time and money.

Replies are listed 'Best First'.
Re^4: Finding target unspecified value
by Latnam (Novice) on Oct 20, 2013 at 21:19 UTC
    Boftx that solved the riddle for me. I appreciate taking your time with this on me. I feel like when trying to understand Perl I was told to build a house with a whoopee cushion. Also I appreciate others input as well. Hopefully I can get the hang of this so I can be quasi useful to someone else.