Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by leocharre (Priest)
on Feb 11, 2010 at 21:08 UTC ( #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.


Comment on Re: Concatenate to keys in a hash whilst doing substitution on values
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-12-25 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls