in reply to How Does Interpolation Work?

If you're using variable interpolation, Perl may not always understand exactly what you intend. To get your code to print "yesgoodbye", try putting braces around the variable to force Perl to recognize exactly what variable it's interpolating:
print "${hello}goodbye";

Update: I find it somewhat amusing that no one (as of this posting) pointed fx's obvious solution. So I can't help but wonder, are there inherent problems with his solution, or does one person suggesting a solution lead the PerlSheep (that would include me) down a narrow path?

Replies are listed 'Best First'.
RE: (Ovid) Re: How Does Interpolation Work?
by fx (Pilgrim) on Jul 21, 2000 at 20:11 UTC
    In this situation: print $hello, "goodbye\n"; would also work I believe, and clearly separates the variable from the string. == fx, Infinity is Colourless