Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: how add option to my program?

by ambs (Pilgrim)
on Mar 26, 2005 at 19:49 UTC ( #442549=note: print w/replies, xml ) Need Help??


in reply to how add option to my program?

For simple switches (with only one - before the switch) you can use
#!/usr/bin/perl -s
When you call this script with a swtich (say, -foo) the $foo variable gets defined. If you use it with a value (say, -foo=bar) then $foo will get the 'bar' value.

It is not so powerfull as getopt, but is useful for small tasks.

Alberto Simões

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2021-10-17 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (71 votes). Check out past polls.

    Notices?