Thanks for a succinct answer. Obviously, I would need to ensure that the appropriate parameters are prefixed ("--") to support GetOptions.

Your answer raises two further questions if you'll indulge me:

-why the different handling of arguments re: command line vs CGI -- and where, if anyplace, is that documented? I read and looked up references for 'parameters' and 'arguments' for a full day before I posted the question, and didn't see anything that hinted at the issue;

-could you possibly explain the REALLY bizarre CGI response when I test-run your logic on Win32 and my ISPs SUN server?

use CGI; my $qry = new CGI; my $argCt = @ARGV; for ($i=0; $i < $argCt; $i++) { print "Arg $i = [$ARGV[$i]]\n"; } print "No args found\n" if $argCt == 0; foreach my $key ( $qry->param ) { if ( $qry->param($key) ) { foreach my $value ( $qry->param($key) ) { print "key, value are $key, $value\n"; } } else { # arg-less booleans print "key-only is $key\n"; } } print "Arg(0) is [$ARGV[0]], param list is [", $qry->param(),"]\n";
which given the following command lines, produces the given output:
perl stuff.pl a b c Arg[0] = a Arg[1] = b Arg[2] = c key, value are keywords, a key, value are keywords, b key, value are keywords, c Arg(0) is [a], param list is [keywords]
but
perl stuff.pl a b= Arg[0] = a Arg[1] = b= key-only is a key-only is b Arg(0) is [a], param list is [ab]
Note that the "arg-less" booleans appear to have values until ONE value is either specified, OR an "=" trails the value??? (As you noted, on the SUN/OS webserver, the arguments are undefined; the wierd "keywords" 'parameter' happens both on the Win32 command line AND when I run this on the website via the browser with
http:...stuff.cgi?a&b

Thanks!


In reply to Re: Why does Getopt::Long ignore browser and SSI-based parameters? by ayurkowski
in thread Why does Getopt::Long ignore browser and SSI-based parameters? by ayurkowski

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.