AW: about dispatch tables

2010-05-05 Thread Thomas Bätzler
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/

AW: about dispatch tables

2010-05-05 Thread Thomas Bätzler
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,

Re: AW: about dispatch tables

2010-05-05 Thread Harry Putnam
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

Re: AW: about dispatch tables

2010-05-06 Thread Harry Putnam
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