![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
using a hash to do substitution?by mr.dunstan (Monk) |
on Jun 14, 2001 at 05:10 UTC ( #88265=perlquestion: print w/replies, xml ) | Need Help?? |
mr.dunstan has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to do some hardcore substitution in a chunk of text, where the things I am searching for and substituting are stored in a hash ...
my %hash; $hash{'usernamevar'} = "mr.dunstan"; Now lets look at the untouched content ... I am usernamevar. drum roll ... *.*.* magical perl regexp thingy happens *.*.* I am mr.dunstan. "Ta da!" The content now has the value of $hash{'usernamevar'} magically substituted wherever the text usernamevar appears in the content. "There are only 35 chambers, there is no 36th." "I know ... I want to create a new one ..." - Shaolin Master Killer
Back to
Seekers of Perl Wisdom
|
|