in reply to Baby Steps "if" behavior?

... also: Does `$kaka = param("formkaka");` define $kaka (according to if (defined $kaka)) even if the parameter "formkaka" was not submitted? Thanks again. TTFN

-PipTigger

p.s. I just realized that root@eruditorium.org is not necessarily the superuser of that server since Enoch is... =)!
p.p.s. Do we have to escape double quotes in titles somehow so that they appear correctly? I missed that too!
p.p.p.s. Please forgive me for forgetting to close the anchor tag in the main post. I'd change it if I could.

Replies are listed 'Best First'.
RE: Re: Baby Steps
by chromatic (Archbishop) on Jun 22, 2000 at 23:55 UTC
    If you're using CGI.pm, it looks like calling param() for an unsubmitted parameter returns undef. The snippet I used to test this is:

    print "Undefined parameter: >>"; print defined ($q->param('undefined')) ? "defined" : "not defined"; print "<<\n<p>";
    (Obviously, there's more to it than that, but anyone who knows enough to ask this question ought to know what else to add.)
RE: Re: Baby Steps
by wayne keenan (Novice) on Jun 23, 2000 at 17:01 UTC
    'exists' is used to find out if a hash key exists, this is needed because perl will create a key/value pair even if you are just 'seeing if it's there'. (e.g, its not use on scalars as such) also, the -e (and friends) flags are file test operators where parameter is the name of a file. if (-e /mnt/dos/command.com) { print "good choice, show who's in charge\n"; } see 'perldoc perlfunc' for a list of the file tests you can perform.