open LOG,'logfile' or die "Can't open 'logfile': $!\n"; my $max = 0; while () { $_ = substr( $_,27,6 ); # make sure the position and length are ok $max = $_ if $_ > $max; # if it's not numeric, it's 0 and never more than $max } print "max = $max\n";