Siegfried Heintze wrote:
> How do I distinguish between no value and false? I thought defined was
> supposed to do that.
> 
> So if I call $q->param("xyz"), how do I distinguish between
> &xyz=0&abc and &xyz=&abc and xyz being absent all together?

param() will return undef in scalar context, or an empty list in list
context if the parameter is totally absent.

So if the query string is 'xyz=0&abc', param('xyz') will return '0'.

If the query string is 'xyz=&abc', param('xyz') will return ''.

If the query string is 'abc=foo', param('xyz') will return undef (in scalar
context)

So, you can do something like:

    my $xyz = param('xyz');
    if (defined $xyz) {
        print "parameter xyz was present. it's value is [$xyz]\n";
    }

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to