Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Best practice on escapes in interpolated strings

by Dallaylaen (Monk)
on Jul 29, 2013 at 16:16 UTC ( #1046888=note: print w/ replies, xml ) Need Help??


in reply to Best practice on escapes in interpolated strings

I've recently stumbled upon String::Format. Although I haven't used it yet, I believe it to be a possible solution for such cases. In a nutshell:

#!/usr/bin/perl -w use strict; use String::Format qw(stringf); print stringf( "%a->%o->%a\n", a => "apples", o => "oranges" );

I don't know how fast it is, though.

UPDATE: I like the %(foo) solution even more!


Comment on Re: Best practice on escapes in interpolated strings
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-03-30 05:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:









    Results (633 votes), past polls