On Wed, Jan 12, 2011 at 11:03 AM, Jim Gibson <jimsgib...@gmail.com> 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> <bamcc...@gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamcc...@castopulence.org>

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to