[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-beginners
Subject:    postderef with subroutines
From:       Luca Ferrari <fluca1978 () infinito ! it>
Date:       2017-05-11 11:10:03
Message-ID: CAKoxK+5mv17NZXCiDmJB_chWDBJCvQTDF3UPp+SFoP2+F6fAMA () mail ! gmail ! com
[Download RAW message or body]

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?

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic