Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
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;
            tr/a/z/;
            warn "\tnow it is [$_]\n";
            }

    print() is the best debugger ever invented. :)

    Various people have tried to conv
  • The reason I wrote it as

    s/-/ /g for @array;

    instead of

    for ( @array ) {
        s/-/ /g;
    }

    was not to save keystrokes, but to put the interesting part of the code first. I think of how I'd say it in English:

    Change any dashes to spaces throughout the list

    instead of

    Throughout the list, change any dashes to spaces

    I think about that a lot. That's why I like the "open or die" metaphor instead of what I see as entirely backwards "die unless open".

    --

    --
    xoa