#!/usr/bin/perl my $server = `uname -n`; print $server; chomp $server; # Display all the files in /tmp directory. $dir = "/usr/ent/newdir/db/sign/*"; my @files = ; open(my $outfh, '>', '/tmp/output1.txt') or die "cannot open file"; foreach $LINE (@files ){ print $outfh $LINE; close FH; } use File::Copy; {$oldlocation = "/tmp/output1.txt"; $newlocation = "/tmp/output3.txt"; copy($oldlocation, $newlocation); }