my $large_file = '/tmp/some_large_file.txt'; open(my $in, '<', $large_file) or die "Cannot read $large_file: $!"; while (<$in>) { # do something with $_ } # close is optional once $in goes out of scope close($in)