Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Templates on the cheap?

by chipmunk (Parson)
on Nov 29, 2000 at 01:36 UTC ( [id://43780]=note: print w/replies, xml ) Need Help??


in reply to Templates on the cheap?

Assuming your variable names are well-formed, this is one possibility: s/\$(\w+)/"\$$1"/gee; A preferable solution (that was suggested recently in another thread) is to use a hash instead of named variables:
$vals{maintainer} = 'root@god.com'; s/\$(\w+)/$vals{$1}/g;
I would lean towards using one of the Template modules, though, for robustness.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://43780]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found