http://www.perlmonks.org?node_id=344042


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