novice2015 has asked for the wisdom of the Perl Monks concerning the following question:
I am a total beginner and have a script like this: It runs fine the only problem is it does not copy the data in output1.txt to output3.txt. It creates output3.txt but does not copy the data. Why?
#!/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 = </usr/ent/newdir/db/sign/*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); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can't copy file
by toolic (Bishop) on Mar 30, 2015 at 20:17 UTC | |
Re: Can't copy file
by Laurent_R (Canon) on Mar 30, 2015 at 20:56 UTC | |
Re: Can't copy file
by redgreen (Priest) on Mar 30, 2015 at 20:22 UTC | |
Re: Can't copy file
by marinersk (Priest) on Mar 30, 2015 at 21:10 UTC |
Back to
Seekers of Perl Wisdom