NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
That looks like transliteration. (Score:1)
tr/a/z/ for @array;
Those sorts of loops always seem to mess with my mind though, and eventually I want to add another statement, so I always end up using the more common block form.
foreach ( @array )
{
warn "Working on [$_]\n" if $Debug;
tr/a/z/;
warn "\tnow it is [$_]\n";
}
print() is the best debugger ever invented.
Various people have tried to convince me that I should optimize my keystrokes, but when I look at the parts of the coding process that I spend the most time in (maintenance), I realize that those little savings cost more time later, at least for me. I have used those statement modifier loops, but at some point I have to convert them to the block form when I need to do something else.
I still commonly type
return unless open my $fh, $file;
which I almost always have to rewrite in the same way because I want to put some other code in the unless() block (e.g. setting error variables, carping, etc.).
Reply to This