Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 chanting in the Monastery: (15)
As of 2015-07-07 14:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (89 votes), past polls