in reply to Re: command prompt help
in thread command prompt help

<rant> Why does everyone swear by CGI.pm? For many simple CGI scripts, it is simply overkill. I use a simple little subroutine that creates a hash out of all the name/value pairs at it works fine. </rant>

I think perhaps the author of the question was wondering how to access command line arguments, and was merely using the CGI example to illustrate what he was saying.

If so, Perl stores command-line arguments in the @ARGV array.

If you want to simply treat all the arguments as one, you can just do:

$arguments = join(' ', @ARGV); # do something with $arguments
If you want to examine each argument in turn, you can just do:

foreach $argument (@ARGV) { # Do something with $argument }

Replies are listed 'Best First'.
RE: RE: Re: command prompt help
by ivey (Beadle) on Jun 07, 2000 at 01:00 UTC
    i've been wondering the same thing...i just recently started doing more CGI work, having been doing java abstraction stuff, as well as sysadmin.

    unless you're doing lots of form handling, it seems like major overkill just to parse one QUERY_STRING. and remember the syntax of h1 for you.

    michael d. ivey, <ivey@gweezlebur.com>

RE: RE: Re: command prompt help
by KM (Priest) on Jun 07, 2000 at 03:30 UTC
    First, CGI.pm will parse the QUERY_STRING so you don't need to, and likely more cleanly than you. Secondly, your little lines of code above will not work with CGI scripts. Why would someone even try to use @ARGV with CGI? Currently, CGI.pm may be slightly bulky, but it does its job well, is maintained, and if it is so expensive for you to use, you need to upgrade your hardware.

    Cheers,
    KM