Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: string initialization error

by haukex (Archbishop)
on Dec 21, 2018 at 15:44 UTC ( [id://1227571]=note: print w/replies, xml ) Need Help??


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; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1227571]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-19 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found