On Wed, Jan 12, 2011 at 11:03 AM, Jim Gibson <[email protected]> wrote:
> Methods and subroutines are not called ("interpolated") within double
> quotes.
Unless you choose to be dirty and "trick"[1] Perl into doing it anyway:
print "@{[ $child->Tag() ]}\n";
Thanks to array dereferencing (i.e., @{} ) an anonymous array
reference (i.e., [] ).
Of course, it's more difficult to read and write (i.e., error-prone),
and probably somewhat wasteful considering the extra steps needed to
make it happen, so Jim Gibson's suggestion to print the result
directly or store it into a scalar first is certainly preferred in
good code. :P As I said, it's dirty. ^^
[1] http://www.perlcircus.org/subs.shtml
--
Brandon McCaig <http://www.bamccaig.com> <[email protected]>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <[email protected]>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/