Slash Boxes
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • # TIMTOWTDI :)
    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;
            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.).