develooper Front page | perl.perl5.porters | Postings from October 2007

Re: [perl #46947] method { expression } { $foo => "bar" }

Thread Previous
From:
Rafael Garcia-Suarez
Date:
October 28, 2007 15:28
Subject:
Re: [perl #46947] method { expression } { $foo => "bar" }
Message ID:
b77c1dce0710281528i7b94579bradaea31598bef896@mail.gmail.com
On 27/10/2007, via RT Father Chrysostomos <perlbug-followup@perl.org> wrote:
> I can call a method on the result of an expression with indirect
> object syntax, giving it a hash ref, like this:
>
> method { some(complex() + 'expression' } { foo => 'bar' }
>
> But, if I change 'foo' to $foo, I get a syntax error message:
> syntax error at -e line 1, near "} { "

I think that's one of those cases where one needs to add a + in front
of the hashref to disambiguate it. Not much possible to change it
actually...

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About