Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: How can we interpolate an expression??

by Anonymous Monk
on Sep 20, 2012 at 18:06 UTC ( #994714=note: print w/ replies, xml ) Need Help??

in reply to Re: How can we interpolate an expression??
in thread How can we interpolate an expression??

print "The square of $answer is ", $answer * $answer, "\n";

print takes a list :) this list can be of a single item. join takes a list and makes it a single string

print join '', "The square of $answer is ", $answer * $answer, "\n";

you can also use the join operator (concatenation)

print "The square of $answer is ". $answer * $answer. "\n";

If you insist on interpolation, see
@ always interpolates an array in double-quotish strings
Arbitrary expressions are evaluated inside braces within double quotes

Comment on Re^2: How can we interpolate an expression??
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2015-11-30 13:24 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (770 votes), past polls