#!/usr/bin/perl
use warnings;
use strict;
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";
print {$output} while (<$input>); ## This is were the problem is.
close( $input );
close( $output );
####
syntax error at test.pl line 12, near "} while"
Execution of test.pl aborted due to compilation errors.
####
print $output while (<$input>);
####
GLOB(0x84f3bdc)GLOB(0x84f3bdc)....
####
print {$output} $_ while (<$input>);
or
print $output $_ while (<$input>);
####
#!/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 );