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; } }
In reply to Re^2: string initialization error
by haukex
in thread string initialization error
by *alexandre*
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |