I am trying to get the maximum number in a file looking like:
1 5001 2 5002 3 5003 4 5004 5 5005 6 5006 7 5007 8 5008 9 5009 10 5010 11 5011 12 5012 13 5013 14 5014 15 5015 16 5016 17 5017 18 5018 19 5019
How about something really simple:
use strict; use warnings;
open IN, "<", "num2.txt" or die "Cannot open num2.txt: $!"; my $max = 0; # change this if you might have negative numbers while (<IN>) { chomp; my ($id, $val) = split; $max = $val if $val > $max; } close IN; print "Max: $max\n";
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]