Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Creating dynamic variables

by Corion (Pope)
on Jan 03, 2013 at 09:52 UTC ( #1011429=note: print w/ replies, xml ) Need Help??


in reply to Creating dynamic variables

Maybe you want a templating system instead? sprintf is the simplest one, and it could be used in your case as follows:

$foo = "hello"; my $x = "$foo%s"; my $output = sprintf $x, $y; # replaces "%s" with $y print $output;

There are many, many more templating systems, with varying easy of use and complexity. I recommend looking at simple string substitution first.


Comment on Re: Creating dynamic variables
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2014-11-28 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (193 votes), past polls