in reply to open file and write the content into another file

Variable interpolation happens only inside double quotes.
Change this
open my $fh, '<$filename' or die "Can't open $filename: $!"; open my $dat1, '>$output' or die "\nERROR: Cannot create/open $out
to
open my $fh, "<$filename" or die "Can't open $filename: $!"; open my $dat1, ">$output" or die "\nERROR: Cannot create/open $out

use Perl;
Perl4Everything

Replies are listed 'Best First'.
Re^2: open file and write the content into another file
by AnomalousMonk (Archbishop) on Sep 09, 2011 at 12:25 UTC
    Variable interpolation happens only inside double quotes. Change this ... to ...

    And perhaps even better, change to the three-argument form of open:
        open my $fh, '<', $filename or die "Can't open '$filename': $!";
    (no need to string-interpolate  $filename in  open call, quoting  $filename in error message makes all whitespace explicit).