in reply to Perl - Linux - Unable to Write Files

$outputfile is always empty ... thats not good ... and you're not checking to see that open failed ( autodie can check for you)

Try this, it comes with error checking

#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; for my $infile ( glob "*.dat" ){ my $outfile = "$file.bak" ; path( $infile )->copy( $outfile ); }