### Open the file if (open (FH, "file.txt")) { ### Run through each line of the file (line will be put in $_) while () { ### Set the maximum to -1 my $max = -1; ### Run through all the numbers on this line while (m/([0-9\.\-]+)/g) { ### number is put in $1 by regexp if ($1 > $max) { $max = $1; } } print "$max\n"; } close (FH); }