Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: A Tk callback problem

by stefp (Vicar)
on Jul 07, 2002 at 19:35 UTC ( #180014=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://180014]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2021-03-01 16:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (13 votes). Check out past polls.

    Notices?