Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Append to file or create file depending on input filename.

by JadeNB (Chaplain)
on Nov 20, 2009 at 14:14 UTC ( #808447=note: print w/replies, xml ) Need Help??


in reply to Append to file or create file depending on input filename.

In a similar vein to bellaire's reply, how about
open $filehandle, (@ARGV == 1 ? '>' : ()), @ARGV;
? This lets the user specify the mode on the command line just as you would in the program, using another argument.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2021-05-14 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (150 votes). Check out past polls.

    Notices?