in reply to Re: string initialization error
in thread string initialization error
or: my $page = $query->param("page") || '';
Caveat: That will also assign '' to $page if $query->param("page") returns 0 or "0" (the same applies to hippo's answer).
TIMTOWTDI: Another alternative to the code from the OP may be (at least on Perl v5.12 and up):
sub loadPage { my $page = $query->param("page"); if ( length($page) && $page eq 'main' ) { loadMainPage(); return 1; } }
|
|---|