Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: CGI.pm and Use of uninitialized value in pattern match

by jeffa (Bishop)
on Jan 21, 2009 at 14:26 UTC ( [id://737835]=note: print w/replies, xml ) Need Help??


in reply to CGI.pm and Use of uninitialized value in pattern match

Try this:

$user = $1 if $query->param('user') && $query->param('user') =~ /(\w{3 +,12})/;
Or, if the value zero is valid:
$user = $1 if defined( $query->param('user') ) && $query->param('user' +) =~ /(\w{3,12})/;
etc. The idea is to first check for defined-ness and then act on that variable if it is.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-25 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found