in reply to Re: Re: Proper way to print a large number of strings
in thread Proper way to print a large number of strings
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Proper way to print a large number of strings (use scalar interpolation)
by Aristotle (Chancellor) on Jan 11, 2003 at 16:39 UTC |