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

Re: Concatenate to keys in a hash whilst doing substitution on values

by leocharre (Priest)
on Feb 11, 2010 at 21:08 UTC ( [id://822757]=note: print w/replies, xml ) Need Help??


in reply to Concatenate to keys in a hash whilst doing substitution on values

As for the "Use of uninitialized value in substitution.." error.. This is because the string/value/thing you are trying to regex/match into, is not defined.

my $value_0; my $value_1 = 'i have a defined value'; my $value_2 = 0; $value_0=~/content/; # this will complain $value_1=~/content/; # won't complain $value_2=~/content/; # won't complain

So, one thing you can do to avoid the error is:

if ( defined $value_0 and $value_0=~/content/ ){ ...

You can run the command 'perldoc -f defined' for more info.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-03-28 13:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found