I have a script thing.cgi which parses a query string and uses those values. Normally, the query string is embedded in a link on a web page. I want to run it from the command line in the shell. But I can't find any info on how to do this with a query string appended.
I tried:
perl thing.cgi?foo=bar
but I got
Can't open perl script "perl thing.cgi?foo=bar": No such file or directory
How do I do this?
Thanks!
Perry
Just separate your parameters with spaces, like so:
perl test.cgi var1 var2
You can refer to each piece of data as $ARGV[0], $ARGV[1], etc.
If you use the = sign to make a name/value pair then that counts as one piece of data. For example:
perl test.cgi fruit=banana error=booboo
In this case $ARGV[0] is "fruit=banana" and $ARGV[1] is "error=booboo".
I think there's a param function that splits them up for you automatically, but I always use just values in my query strings, not names and values, so I'm not really familiar with it. But I guess what you really wanted to know was how to use a query string in the shell, and the short answer is to just use spaces.