in reply to strict problem

First comment, take a look at CGI, It comes standard with any recent version of perl.
(The cgi-lib site may say it "has become the de facto standard library" for CGIs, but you'll aso notice that page was last updated in 1998.)

Second comment: whenever post to perlmonks, you should allways post your acctual code (or the smallest example you can write that causes hte same error), and the exact error you get -- it helps people help you

Third comment: if you must use cgi-lib.pl, please read the documentation and examples more carefully (&ReadParse doesn't return an array)

(Edited: i just realized that [CPAN://CGI] isn't as usefull of a link as I thought, so i updated it to point to the local copy of the CGI perldoc)

Replies are listed 'Best First'.
Re: Re: strict
by Anonymous Monk on Mar 20, 2002 at 17:36 UTC

    1) I will take a serious look at CGI - thanks for the pointer!

    2) ok, I'll remember - I just didn't want to flood this forum for a question that seems as trivial as this one.

    3) I know cgi-lib returns a hash, sorry - I was just playing around with everything, and got a bit confused because of the late hour.

      I know cgi-lib returns a hash, sorry - I was just playing around with everything, and got a bit confused because of the late hour.

      Go re-read the docs (or i should say: go re-read the examples & source since cgi-lib.pl is so horribly documented)...

      # Returns >0 if there was input, 0 if there was no input # undef indicates some failure.

      It doesn't return a hash, or an array.

        if (($in{'pic'} =~ /^[a-z0-9-_]+\.jpg$/i) && ($in{'cat'} =~ /^[1-7]$/) +) { &showPic($in{'pic'}, $in{'cat'}); } elsif ($in{'cat'} =~ /^[1-7]$/) { &showCat($in{'cat'}); } else { &showError; }

        Hmm... That is a hash, isn't it?

        Doh... Ofcourse I can't use the return value of the function, since it's just that - a scalar. Anyway, I use the hash %in that's defined in the function itself, it caries all keys and values.

        The script itself works, I've been using it this way in several websites... I just really want to start using strict and get a better understanding of it all, instead of just 'making it work'.

        Ofcourse, that doesn't mean that it shouldn't work... :)