in reply to while or for?

Doing something because it's shorter is not a good reason outside of a golf game. Particularly if the two versions have the same number of operations. If you are performing operations, why not make it understandable and take 3 lines to do it? Whitespace is cheap - in fact cheaper than the extra time it takes to mentally parse an unnecessarily complicated line.

In this vein, see The path to mastery.

Replies are listed 'Best First'.
Re: Re: while or for?
by Skeeve (Parson) on Jul 22, 2003 at 05:43 UTC
    Hey... I'm on training for the next minigolf ;-)

    If I do scripts that should last longer than, say 2 days, I normaly write a clean, commented loop with use strict and use warnings and all the bells and whistles ;-)

    But this was just a quick shot :-) I won't use the script any longer as soon as it did it's work.

    But you are right and I hope that some perl beginners will read this and your comment and learn from it.