On Thu, 11 May 2017 13:10:03 +0200
Luca Ferrari <fluca1...@infinito.it> wrote:

> Hi all,
> according to the documentation the postderef for code blocks $ref->&*
> and $ref->() have different meanings
> <https://perldoc.perl.org/perlref.html#Postfix-Dereference-Syntax>
> 
> While I can use the following:
> 
> my $sub_ref = sub { say "Hello world: @_ !" };
> $sub_ref->( 'and the camels go' );
> &{ $sub_ref }( 'and the camels go' );
> $sub_ref->&* ;
> 
> is it possible to pass argument to the function via postderef?
> Something like the not working code:
> 
> $sub_ref->& ( 'and the camels go' );
> 
> Any idea?
> 

{
    local @_ = ( 'and the camels go' );
    $sub_ref->&*;
}


-- 
Don't stop where the ink does.

        Shawn H Corey

-- 
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