open my $in, '<', $input or die $!; open my $out, '>', $output or die $!; while(<$in>){ # do stuff to $_ print $out $_; # or whatever output you come up with }