if(open my $fh, '<', $file){ # process file } # file will be closed when we reach here