jordandanford has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I'm a newcomer to Linux/Perl scripting, and I have a question - how do I effectively use flags in my Perl scripts?
For example, let's say I have a scripts that outputs the standard deviation of a list of numbers - I want to extend the functionality of this by adding a flag -m, causing the script to additionally output the mean of the data as well.
Here's what happens normally when run on a command line:
./stdev.pl 3 7 7 19 6
What I want is for it to work like so:
./stdev.pl -m 3 7 7 19 6, mean 9
How would I allow my script to detect such a flag?
Thanks!
-Jordan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Usage of flags in scripts
by Lawliet (Curate) on Dec 31, 2008 at 23:06 UTC | |
by Your Mother (Archbishop) on Jan 01, 2009 at 00:03 UTC | |
by McDarren (Abbot) on Jan 01, 2009 at 03:17 UTC | |
by JadeNB (Chaplain) on Jan 01, 2009 at 18:25 UTC | |
by Lawliet (Curate) on Jan 01, 2009 at 02:21 UTC | |
by jordandanford (Initiate) on Jan 01, 2009 at 01:24 UTC | |
by Lawliet (Curate) on Jan 01, 2009 at 02:03 UTC | |
by jordandanford (Initiate) on Jan 01, 2009 at 02:19 UTC | |
by JadeNB (Chaplain) on Jan 01, 2009 at 18:28 UTC | |
by Marshall (Canon) on Jan 01, 2009 at 03:00 UTC | |
by Marshall (Canon) on Jan 01, 2009 at 03:14 UTC | |
|
Re: Usage of flags in scripts
by MarkovChain (Sexton) on Jan 01, 2009 at 06:30 UTC |