Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Im trying to add a variable string to a string I'm using to index a hash. How can I do this? Any Ideas, I'd be grateful, cheers!!
Perl keeps telling my variable isn't initialised..
$hash{'colourred'} = 'RED'; $hash{'colourblue'} = 'BLUE'; $t='colour'; print $hash{"$t.red"} print $hash{"$t.blue"}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Concatenating strings to use in a hash..
by Laurent_R (Canon) on Feb 08, 2015 at 18:19 UTC | |
|
Re: Concatenating strings to use in a hash..
by Anonymous Monk on Feb 08, 2015 at 15:58 UTC | |
|
Re: Concatenating strings to use in a hash..
by Anonymous Monk on Feb 08, 2015 at 15:55 UTC |