Hi
limekiller,
You need to look at
GetOpt::Long which comes with the standard perl distribution I think.
It does what you want - handling multiple value command line options with long names. You might want to look at the other assortment of GetOpt::* modules that there are too.
Update: You might not want to have all three ip adresses under the same commandline-option name, since you are scp-ing to 2 computers and then connecting to the third the GetOpt::*, might not put them in the correct order - but even if it it does, your users might not, you can cut down errors if you have 2 or 3 option names, like:
checkfilter.pl -machine1 '192.168.0.1' -machine2 '192.168.0.2' -machi
+ne3 '192.168.0.3'
# or
checkfilter.pl -mtr '192.168.0.1' -mtr '192.168.0.2' -nmap '192.168.0
+.3'
With the second example, you could loop through the -mtr switches, mtr and scp to it, then ssh and nmap to -nmap. This would mean you could add as many "-mtr"s as you want. Does this make sense - I know only a little about mtr and nmap?
$code or die
Using perl at
The Spiders Web
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.