Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Style: buried variables or double referencing?

by Roger (Parson)
on Aug 20, 2005 at 22:58 UTC ( #485436=note: print w/replies, xml ) Need Help??

in reply to Style: buried variables or double referencing?

Good programming style: High Cohesion, low coupling. That doesn't only apply across modules, but also applies to functions and code within the same module.

I will use a small sub to return the count so that how you actually implement the count is abstracted from the caller's logic:

for $i (0..varcount($some_variable)) { ... } sub varcount { # you can implement the count any way you like # and change the implementation any time you like, # the caller will not get affected, as long as the # interface to varcount is unchanged }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2022-12-08 02:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found