laziness, impatience, and hubris | |
PerlMonks |
Handling Parametersby xorl (Deacon) |
on Jan 07, 2009 at 16:07 UTC ( [id://734656]=perlquestion: print w/replies, xml ) | Need Help?? |
xorl has asked for the wisdom of the Perl Monks concerning the following question:
I've seen lots of scripts where you can invoke them with flags followed by parameters (hopefully that's the right terminology)like this:
The problem is I don't know how to take that input and use it in the script. I know how to use @ARGV, but that would mean no flags and the params would have to be in the correct and same order every time. The only solution I can think of right now is to loop through @ARGV. Something about this just says to me there has to be a better way. Is there? Thanks in advance Edit: Big thanks to borisz for the first, most concise, and most useful answer. Thanks to everyone else as well.
Back to
Seekers of Perl Wisdom
|
|