Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: On Foreach Loops and Maintainability

by Helter (Chaplain)
on Oct 11, 2002 at 17:36 UTC ( [id://204595]=note: print w/replies, xml ) Need Help??


in reply to Re: On Foreach Loops and Maintainability
in thread On Foreach Loops and Maintainability

But it's only in 1 place that you have to look to change the code. What if you use the construct "arg$_" multiple times in the body of the loop? It will be slightly harder to change that, and make sure you have gotten them all.

Counting the keystrokes in my favorite editor to change arg to param in any of the above examples: ctrl-shift-5 a r g \n p a r a m \n !

12 keystrokes, easy enough. If you are worried about replacing other things, then it's +1 stroke per interactive search/replace....

Like FoxCub said, I think if you have both methods in your toolbox, and can use them when appropriate, then you are a better programmer for it.

  • Comment on Re: Re: On Foreach Loops and Maintainability

Replies are listed 'Best First'.
Re: Re: Re: On Foreach Loops and Maintainability
by perrin (Chancellor) on Oct 11, 2002 at 17:53 UTC
    That's true, but it sets off my "once and only once" radar. I don't like repeating things.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found