#!/usr/bin/perl use warnings; use strict; open( 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"; print OUTPUT while (<$input>); close( $input ); close( OUTPUT );