Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Best practice on escapes in interpolated strings

by Dallaylaen (Friar)
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!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046888]
help
Chatterbox?
[LanX]: damn sun ...blame Ophelia!
[choroba]: Yesterday, I gave Ramirez a headshot through the gate in Aztec. LOL. What happened to you? WTF? Sun. There was a hole in the window foil.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2017-10-18 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (245 votes). Check out past polls.

    Notices?