Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Can't copy file

by marinersk (Priest)
on Mar 30, 2015 at 21:10 UTC ( [id://1121904]=note: print w/replies, xml ) Need Help??


in reply to Can't copy file

novice2015 has asked for the wisdom of the Perl Monks concerning the following question:

     I am a total beginner

Excellent -- and welcome to the Monastary. Please add the following to your script; I strongly urge you to never remove them:

     #!/usr/bin/perl
     use strict;
     use warnings;
     my $server = `uname -n`;
     print $server;
     chomp $server;
     # Display all the files in /tmp directory.
     
my $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
my $LINE (@files ){
         print $outfh $LINE;
         close FH;
     }
     use File::Copy;
     {
         
my $oldlocation = "/tmp/output1.txt";
         
my $newlocation = "/tmp/output3.txt";
         copy($oldlocation, $newlocation);
     }
     exit;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1121904]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2024-04-23 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found