Thanks :S
You should use CGI.pm to fetch the query string data and do the redirction, and yes, you must use a? after the URI and then a name/value pair:
query string:
www.site.com?name=value
perl script:
[3]
#!perl
use CGI qw/:standard/;
my $query = param('name');
print redirect('http://www.website.com/$query');
[/3]
I put $query on the and of the URL assuming you wanted to use it in the redirection, if not, just remove it.
CGI or cgi is actually a protocol, Common Gateway Interface, which tells computers how to share data over the internet. The .cgi extension became synonymous with web based perl scripts back in the day and has managed to stick to this very day.
.pl is generally a perl script
.pm is generally a perl module (a library)
you can use .cgi or .pl for the most part anywhere or anytime, just depends on what you prefer. save the .pm extension only for modules as they are treated a little differently by perl during compile time when compiled with the "use" operator. Which is why you can write:
use CGI; (no quotes)
and perl will look for that module in the special array @INC
but must write:
require "path/to/CGI.pm";
When you submit a form from the web or send a query string to a script
test.cgi?my_name=rocknbil&you=boo
It comes to your script in a encoded form. That is, spaces are turned into numeric ASCII equivalents, and in the case of file uploads, even binary data can be included in this data stream.
The first thing that happens when this is sent to your script is that this data must be read in and parsed- turn the spaces back to spaces and split the name/value pairs into an associated key/value pairs
my_name "rocknbil"
you "boo"
or read in the binary data into a file. You can code a read/parse routine into your script yourself, or do what they are describing here, use a module that already has functions written for the task you need to do.
The module CGI.pm manages read/parse, file upload, generates forms, and has many other functions that deal with web in- and out. It's pretty difficult to find an installation of perl these days that doesn't have this module installed, so read the documentation on CGI.pm and throw the use CGI.pm line into a few scripts and see what happens.
BUT you will learn so much more if you hit the tut's and write a couple read/parse routines yourself, you'll understand the process better and it will only take 10 or so lines of code.