Perl itself can never "recognise the -u as a switch". Getopt::Std might, but @ARGV is where all command line arguments are held. Without a SSCCE (http://sscce.org) it's hard to tell, but your assignment to $miscreants and $reason is position sensitive (they are the first two command line arguments) while the Getopt family (AFAIK) is insensitive, not caring whether the -u 1.2.3.4 is first, last or somewhere in the middle. You are therefore using a mixture and may very well find some things work because of the order of arguments in the invocation. Try moving everything to positional or Getopt-friendly format and you may find your problems easier to solve, even if they don't go away.

I also recommend looking at The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan!. Both modules are core.

Regards,

John Davies


In reply to Re: switch being ignored put into ARGV by davies
in thread [RESOLVED] switch being ignored put into ARGV by Nobby

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.