I get CGI=HASH(0x119960)->p("Test.")use CGI; $cgi = new CGI; print << "HEREDOC"; $cgi->p("Test.") HEREDOC
What you want to do is take a reference to your object, and interpolate it via a scalar reference. Look at the following:
$cgi->p('test') | V \$cgi->p('test') | V ${\$cgi->p('test')}
In Perl 6, ${...} becomes a mere scalar, and no longer a scalar reference, so you'll be able to write ${$cgi->p('test')} which will be pretty cool. Until then, you'll have to make do with using the above hack. Sometimes this is acceptable, sometimes it's better to do something like:
print 'stuff ' . $q->b( $q->i( 'and' )) . ' nonsense'
It all depends on what comes out as being more readable.
In reply to Re:x3 Proper way to print a large number of strings (use scalar interpolation)
by grinder
in thread Proper way to print a large number of strings
by jpfarmer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |