open my $fh,"< file"; while (<$fh>) { # stuff } close $fh;