I think you probably don't want to create a new CGI object every time you call the sub. It would be expensive and there's no need. The call style ( @_, '' ) is kinda weird too and would fail under strict as written. Here's a redraft.
use CGI (); # at top of script/module # transparently take over function param() if desired sub param { my $param = shift || return; my @values = CGI::param($param); return '' unless @values; return wantarray ? @values : $values[0]; }
In reply to Re: Get a CGI::param() variable with undef checking.
by Your Mother
in thread Get a CGI::param() variable with undef checking.
by monoxide
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |