use autodie; ... open my $in_fh, '<', $infile; open my $out_fh, '>', $outfile;