use strict; use warnings; open( my $output, '>', '/tmp/output.txt' ) or die "Error: Cannot open the file - $!\n"; open( my $input, '<', '/tmp/input.txt' ) or die "Error: Cannot open the file - $!\n"; select $output; print while (<$input>); ## This is were the problem is. close( $input ); close( $output );