in reply to storage of numbers
use Scalar::Util qw( looks_like_number ); while( <> ) { next unless looks_like_number($_); chomp; $min = ! defined( $min ) || $min > $_ ? $_ : $min; $max = ! defined( $max ) || $max < $_ ? $_ : $max; } print "\nminimum number: $min\n"; print "maximum number: $max\n";
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: storage of numbers
by vsespb (Chaplain) on Oct 16, 2013 at 17:57 UTC | |
by ww (Archbishop) on Oct 16, 2013 at 19:56 UTC | |
by vsespb (Chaplain) on Oct 16, 2013 at 20:09 UTC | |
by vsespb (Chaplain) on Oct 16, 2013 at 20:07 UTC | |
by davido (Cardinal) on Oct 16, 2013 at 21:23 UTC |