http://qs321.pair.com?node_id=180014


in reply to A Tk callback problem

You should improve style if you want someone to go over your code.

In long subroutines, name your formal parameters by using my ($nm1, $nm2) = @_ to avoid dealing explicitely with @_ within the subroutine. Best code is self-commenting code by savvy use of variables names.

Incidentally, another possible style is to name actual parameters as well. This is especially interesting if some actual parameters may be missing
sub add ( nm1 => $val1, $nm2 => $val1 } sub add { local %_ = ( @_ ); $_{nm1} + $_{nm2} }
If you follow my first advice, this one will be unecessary in this particular case. But here it is anyway, you should use slices:

[\&db_clk, $_[1], $_[2], $_[3], $_[4] ]
could be rewritten
[ \&db_clk, @_[1..4] ]
.

-- stefp -- check out TeXmacs wiki