in reply to Re^2: Perl script to delete files using regex
in thread Perl script to delete files using regex

Yes indeed - much nicer and much more Perl-ish!

I deliberately didn't write it that way though so that CarlosN could (hopefully) understand what is going on.

  • Comment on Re^3: Perl script to delete files using regex

Replies are listed 'Best First'.
Re^4: Perl script to delete files using regex
by GrandFather (Saint) on Nov 24, 2020 at 01:30 UTC

    Clarity is rather in the eye of the beholder. But as a general thing smaller code (as long as it's not obfuscated) is easier to unpack. In this case there are two Perlish things that are likely to trip up a novice. The first is grep which is easy to find documentation for. The second is the list assignment which is kinda hard to formulate a good search for!

    The saving grace is for novices who don't know what they don't know the assignment looks kinda innocuous and it's likely their eyes just glaze over for a moment as they recognize it as a wobbly assignment and move on. For this example that's pretty much OK because the real lesson is filtering a list. That said, YMMV!

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond