in reply to Style, style, style
Almost always the former. Occasionally the latter, if using $_ won't make the loop body any simpler and I'm not dealing with lines as text strings (for instance, while (my $addr = <>) for a file full of IP addresses), but that's a rare thing.
-w. Most of my scripts target 5.005_03.
I don't usually enforce constness. I'm much more likely to say $main::CONSTANT = 'foo'; and just not touch any identifiers in all caps.
Always assign from @_. Less verbose, easier to change, and the list looks more like a formal parameter list to my C-trained eyes.
for. It's less than half the length of foreach. Huffman encoding, etc, etc.
Without brackets, unless that induces precedence lossage.
I'm trying to avoid double-quoted strings unless there's actually some interpolation going on, but I've already formed the habit of double-quoting all strings. We'll see which one wins.
Explicit glob. Angle brackets read from filehandles.
<FOO>. Again, angle brackets read from filehandles.
Usually for (keys %foo), but more out of habit than anything else.
In general, I try for the tersest code that doesn't require a comment.
--
F
o
x
t
r
o
t
U
n
i
f
o
r
m
Found a typo in this node? /msg me
The hell with paco, vote for Erudil!
|
|---|