perl anonymous subroutine within a named subroutine -
regarding below code, how $one_sub , $two_sub become coderef's anonymous subroutines within named sub "sup"? named sub isn't 'returning' 2 anon subs; or it? (at least haven't put such statement).
sub sup { $neh = sub { "this 'neh' subroutine" }; $hen = sub { "this 'hen' subroutine" }; ($neh, $hen); } ($one_sub, $two_sub) = ⊃
using data::dumper::streamer show's :
$code1 = sub { use warnings; use strict; no feature; use feature ':5.10'; q[this 'neh' subroutine]; }; $code1 = sub { use warnings; use strict; no feature; use feature ':5.10'; q[this 'hen' subroutine]; };
to quote perlsub:
if no
return
found , if last statement expression, value returned.
($neh, $hen);
expression. in list context, value 2 anonymous subs.
Comments
Post a Comment