Hi UpTide,
$_ is very generic and I have no idea what it means when I look back over my code
I would have recommended using $_ only over short pieces of code for exactly that reason. So for example, if you write print "$_\n" for 0..2; I personally think it's fine because you know that the scope of this $_ is only that one line. But there's nothing wrong with writing for my $i (0..2) { print "$i\n" } instead! In the same vein, I personally think that for (0..2) { ... } is fine if the loop body is only a few lines long, and I'd go with for my $i (0..2) { ... } if the loop body gets longer (there's a gray area on what is "too long"), but there's nothing wrong with always using the latter! It's all about what you and possible future maintainers would find most readable.
Regards,
-- Hauke D
In reply to Re^5: 36 Conditions in If Statement [sendhelp]]
by haukex
in thread 36 Conditions in If Statement [sendhelp]]
by UpTide
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |