open my($fh), "<", "/path/to/file" or die "can't read /path/to/file: $!"; while (my $line = <$fh>) { # do stuff with $line } close $fh;