Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Style: buried variables or double referencing?

by Roger (Parson)
on Aug 20, 2005 at 22:58 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-03-28 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found