Harry Putnam asked:
[...]
> which is also inside sub dispt {the sub function}. Where does global
> come in?
Hint: $code->(@_);
HTH,
Thomas
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Harry Putnam asked:
> But even though I can work with that... I'm still not seeing why the
> values in @_ are not available at the call to N() inside like this:
> (incomplete code)
>
> func($val1,$val2);
>
> sub func { %h = ( N => sub { print N(@_) . "\n"; } ); }
If you call the sub like this,
Thomas Bätzler writes:
> Harry Putnam asked:
> [...]
>> which is also inside sub dispt {the sub function}. Where does global
>> come in?
>
> Hint: $code->(@_);
Yes, I knew it could be done there... but what to do then when more
function calls are added.
Are you thinking something like:
i
Thomas Bätzler writes:
>> sub func { %h = ( N => sub { print N(@_) . "\n"; } ); }
>
> If you call the sub like this, it'll create the hash %h containing the
> key "N" associated with a code reference to an anonymous
> subroutine. When that subroutine is called it will pass its _current_
> argumen