Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: copying a file with .bak extension

by kennethk (Abbot)
on Nov 07, 2012 at 20:37 UTC ( #1002738=note: print w/ replies, xml ) Need Help??


in reply to Re^2: copying a file with .bak extension
in thread [SOLVED] copying a file with .bak extension

I would argue that's exactly why you should adopt this approach. As a new user, you should avoid using classic Perl "magic", and make sure your code is straight-forward and readable. The script, as I've presented it, loops over the passed file names (@ARGV), tests to make sure you've passed file names that can be found (-e), copies the files using a CORE module (File::Copy) and then modifies the file with an append (perlopentut). It tests if operations succeed and is warnings and strict compliant. I never use command line switches in any of my code unless I'm writing one-liners, and half that time it would have been faster just to write a proper script.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re^3: copying a file with .bak extension

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (14)
As of 2015-07-30 12:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls