Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Useless use of string eq

by naChoZ (Curate)
on Dec 06, 2007 at 15:04 UTC ( #655429=note: print w/replies, xml ) Need Help??


in reply to Useless use of string eq

I could be wrong, but this smells like a good opportunity to learn about Getopt::Long. I tend to use it with the hashref method like this.

use Getopt::Long; my $opts = {}; # # maybe set some overridable defaults... # $opts->{target} = 'foo'; $opts->{cust} = 'SMC'; GetOptions( $opts, 'target=s', 'cust=s', 'cotime=s', );

Now, if you type your_script.pl --target bar --cust FET --cotime baz then your $opts hashref will be populated accordingly. $opts->{target} will be 'bar', $opts->{cust} will be FET, $opts->{cotime} will be 'baz'. Setting defaults as I've demonstrated allows you to skip some of the command line args.

--
naChoZ

Therapy is expensive. Popping bubble wrap is cheap. You choose.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://655429]
help
Chatterbox?
[SuicideJunkie]: email tests, eh? I've gotten dinged for "you can't block this sender as spam, they're internal"
[Corion]: Heh - somebody in our marketing departement thought it was a great idea to use the alerting tool for company-wide outages to announce some new feature ;)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2017-05-24 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?