Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: How to include a string immediately after a variable in a double-quoted string

by stevieb (Canon)
on Nov 20, 2015 at 22:54 UTC ( #1148272=note: print w/replies, xml ) Need Help??


in reply to Re: How to include a string immediately after a variable in a double-quoted string
in thread How to include a string immediately after a variable in a double-quoted string

I always forget about printf in Perl. In Python (3+), there's no interpolation, so I'd have to do print("Hello {}, how are you {}".format(name, today)).

No matter what you want to print with variables, you have to do it this way (at least for a normal print statement), including all the parens and cruft.

I've taken perl interpolation for granted me thinks ;)

Update: While I'm complaining about Python not being Perl, I'll mention I had a colleague (Python coder) state "I bet Perl doesn't have list comprehensions"... I said: say for @array, where they said: [x for x in array], but that only worked for them in REPL... to do it with print in a script, one has to do extra trickery.

I'm only saying this because I've been privy to some of your Ruby rants lately. I just love Perl.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2022-05-28 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?