|Perl: the Markov chain saw|
Re^2: Tact and the Monasteryby Flexx (Pilgrim)
|on Sep 14, 2002 at 22:36 UTC||Need Help??|
I personally think the second of your examples really is more readable. But maybe I'm just a bit nuts.
Myself, I use as few temporary (synthetic) variables as possible, I think they often make things harder to understand. Even if I immediately get the idea what @chars is, I would glance back on every occurance of it, to make sure what your idea of "characters" really is (with or without underscore, hypen, etc.). If the code spreads out, things become even worse...
In your second example, it's right there.
Which brings us back to the topic of this thread. While I am sure that there are some style ideas, any good Perlmonk would propagate, some other things really are a matter of taste.
For example, my block statements look like this:
A pattern I am quite sure most here don't use, even If they'd call it acceptable. Although I'm a developer for longer than I'd admit to an attractive young lady, ;) I still absorb other's styles from time to time. The monastery, CPAN and the like are good places for such inspiration. Just lately I saw a hash initialization like so:
A new pattern I didn't see before, but I liked and absorbed it instantly. It's unprobable to drop a comma on it, and optically, it's much nicer than my old style:
So, IMHO the bottom line is: Tastes are different. The important thing is, that you have style, wich one, matters less.