use strict; my $input_file = 'foobar.txt'; open my $in, $input_file or die "Failed to read $input_file: $!\n"; my $max = do { local $_ = <$in>; chomp; [ split ] }; while ( <$in> ) { chomp; my ( $x, $y ) = split; $max = [ $x, $y ] if $y > $max->[ 1 ]; } close $in; print "max at ($max->[ 0 ], $max->[ 1 ])\n";