note
Anonymous Monk
<p>While I cannot see the changes you made in your example (a problem with node formatting), the answer is yes, you can use whitespace. In fact, <em>please</em> add (a reasonable amount of) whitespace. Separate any logical blocks of code you have with an extra linebreak. I generally sprinkle one after (a group of) variable declarations, too. (But I hate "double-spaced" code.)</p>
<p>Also, use tabs to indent your code. Configure your editor to show them as n spaces, where n is a comfortable value (for you). I generally use a value of two spaces, but whenever I'm reading code I'm unfamiliar with, I'll increase it temporarily to four. It helps me understand the flow better.</p>
<p>You might also like the <c>/x</c> modifier if you're working with regular expressions. And if you don't have a syntax-colouring editor yet, get one immediately! It will help tremendously.</p>
<p>Here's what my code looks like, to give you a rough idea on what I consider OK spacing:</p>
<code>
sub lint {
my ($fn) = $_;
$fn = decode_utf8($fn);
if ($fn ne (my $new_fn = compose($fn))) {
print STDERR "Decomposed unicode: $new_fn\n";
if (!DRY_RUN) {
die if -e $new_fn;
rename($fn, $new_fn) or warn "Failed rename for file $fn";
}
}
if (-f $fn) {
</code>
996700
996700
6