Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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

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 avoiding work at the Monastery: (6)
As of 2016-10-22 08:47 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (294 votes). Check out past polls.