Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: replacing "dynamic" variables

by bbfu (Curate)
on Apr 09, 2004 at 22:00 UTC ( #344042=note: print w/replies, xml ) Need Help??


in reply to replacing "dynamic" variables

Update2: Also, you might want to look into one of the various Config or templating modules (such as Template-Toolkit), as it sounds like you might be trying to roll your own basic templating system.

$line =~ s[ \$ # Dollar sign (literal) { # Open brace (literal) ( # capture (into $1) [^}]+ # One or more non-close brace characters ) # end capture } # Close brace (literal) ][$dynamic_variables{$1}]xg;

Update: Expanded regexp with /x

bbfu
Black flowers blossom
Fearless on my breath

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://344042]
help
Chatterbox?
[erix]: I'll think about that for a bit; I'll figure it out
[erix]: (damn Discipulus for speaking in IQ tests :P )

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-11-17 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?