Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Perl Input Parameters for Unix

by monsoon (Pilgrim)
on Jul 09, 2012 at 15:49 UTC ( #980709=note: print w/ replies, xml ) Need Help??


in reply to Perl Input Parameters for Unix

See if Getopt::Std or Getopt::Long work for you. First recipe here in the cookbook (15.1)


Comment on Re: Perl Input Parameters for Unix
Re^2: Perl Input Parameters for Unix
by frozenwithjoy (Curate) on Jul 09, 2012 at 16:00 UTC
    OP: Different people prefer different approaches, but I recommend Getopt::Long over Getopt::Std, et al. I like being able to use more than just a single letter for the flags to increase readability. Also, you can still abbreviate to a single letter (or unique fragment) to reduce typing when calling the script from the CLI. Another tip: you can set default, overridable values by defining (rather than just declaring) before the Getopts block for whichever variables you want defaults.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2015-07-03 22:57 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 (57 votes), past polls