Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: String interpolation

by gellyfish (Monsignor)
on Dec 09, 2004 at 13:19 UTC ( [id://413525]=note: print w/replies, xml ) Need Help??


in reply to String interpolation

An alternative to the other suggestions is to use (s)printf:

my $str = 'params.%d.arg'; + for my $idx (0 .. 9 ) { printf $str, $idx; }
You will need to be careful in sanitizing the contents of $str if all or part of it is being taken from user (or otherwise untrusted) input .

/J\

Log In?
Username:
Password:

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

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

    No recent polls found