Dear subscribers,

I was in a modular mood and thought it might just be a good idea to 
do the parsing of the querystring in a subroutine. The subroutine 
goes into a separate file that I then 'require' in all my future 
CGI-scripts (is this a good way?).

I thought it would be nice to return a hash with the key/value pairs 
from my querystring. I was thinking of the following:

sub parseit
{
        foreach $name ($q->(param))
        {
                $input{$name} = $q->param($name);
        }
        return \%input;
}

Because a subroutine cannot return a hash (or so I was told) I 
instead return a reference to the hash. I'm not sure if this will 
work. How would I access the data in my main cgi? Or am I making 
things more difficult than they should be?

'There's always more than one way to do it' can be very confusing at times..
-- 
Martijn van Exel, [EMAIL PROTECTED]

WEBkitchen
Waterstraat 11
3511 BW Utrecht
tel/fax 030-6701818

http://www.webkitchen.nl

Reply via email to