Note that this is a non-standard way of doing command line options. That's why Getopt::Long is having trouble recognizing what you want to do. You may have better luck changing the syntax of your script so that it supports something like this:
$ script --id="1.0.0.1 1.0.0.2 1.0.0.3" # split the resulting variable on spaces $ cat >id.dat 1.0.0.1 1.0.0.2 1.0.0.3 $ script --id=@id.dat
In addition, if your script takes no "filename"-like arguments (arguments not preceeded by an option), consider making IP addresses an optional argument in this respect:
Usage: script.pl [-abcde] [ip_address [ip_address ...]]
Or, if your script does depend on, say, one additional argument, consider putting that in a flag, either making that option mandatory or using a suitable default (like stdin for a file), or just add it to the list of non-option arguments:
Usage: script.pl [-abcde] -f filename [ip_address [ip_address ...]] Usage: script.pl [-abcde] filename [ip_address [ip_address ...]]
Multiple arguments after a single option tag is kind of strange for people used to "standard" command line options for scripts and utilities. I would think about re-working the interface instead of trying to force Getopt to play by these other rules.

In reply to Re: Getopt Behavior by Fastolfe
in thread Getopt Behavior by gaspodethewonderdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.