On Jul 2, 9:27 am, [EMAIL PROTECTED] (Rob Dixon) wrote:
> Gabriel Striewe wrote:
> > What do I do wrong?
>
> First of all, the ampersand subroutine designation is outdated and dangerous
> and it is far better to use the indirect notation for a subroutine call:
>
> $hello->()
>
> Perl will interpolate only simple variables or array or hash elements
> or slices. However we can cheat by putting the result of the call into
> an anonymous array and then dereferencing it:
>
> print <<END;
> hello @{[$hello->()]}
> END

And don't worry too much about simply using a string:

my $msg = $hello->();
print <<END;
hello $msg
END

--
Brad


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to