4 ms·
I've not touched Perl aside from modifying and using basic scripts for process automation and administration tasks. But since you called-out Python and Ruby, I
by encoderer 14y ago
I've not touched Perl aside from modifying and using basic scripts for process automation and administration tasks.
But since you called-out Python and Ruby, I'm curious what you meant.
In Python, for example, interpolation would look like:
print "I ate a %s for %s" % ('banana', 'lunch)
(or the newer way with nominally more keystrokes)
print "I ate a {0} for {1}".format('banana', 'lunch')
I've done plenty of PHP work and I get that I can do "{$varhere}" but for strings of any length or complexity it was totally common to use sprintf() an I have to assume the same readability principles apply in Perl?
- ionforce 14y agoIn Perl you could write print "I ate a $fruit for $meal" Or printf 'I ate a %s for %s', $fruit, $meal
- e12e 14y ago"This is %(adjective)s readable Python in %(genetive)s opinion" % {"adjective":"more", "genetive":"my"} > 'This is more readable Python in my opinion' edit: variable names Also, I agree that for this simple case, perl (and other's) simple dollar substitution is nicer.
- e12e 14y agoSince there was a mention of extending the language in this thread, there's also: http://lfw.org/python/Itpl.html http://lfw.org/python/Itpl.html