Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Subroutine to delete one file and copy one file to another

by pme (Prior)
on Jul 20, 2015 at 19:56 UTC ( #1135483=note: print w/replies, xml ) Need Help??


in reply to Subroutine to delete one file and copy one file to another

Hi shroh,

This little piece of code successfully calls deleteTemp().

use strict; # always use 'strictures' use warnings; use File::Copy qw/ copy /; # perl module names are case sensitiv +e my $tempfile = "tempfile.txt"; my $serverlist = "serverlist.txt"; deleteTemp($tempfile, $serverlist); sub deleteTemp { my ($delTemp, $serverlist) = @_; print "temp: $delTemp\n"; print "serv: $serverlist\n"; unlink $delTemp; copy($serverlist,$delTemp); }
UPDATE: Typos fixed. Thanks poj

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2020-01-20 23:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?