in reply to Re: how do I shorten code
in thread how do I shorten code

On a case-insensitive file system (Windows), you can shorten even further by specifying the pattern in the glob:
my @list = grep { -M < 1 } glob "$dir/B*.txt";

Replies are listed 'Best First'.
Re: Re: Re: how do I shorten code
by BrowserUk (Patriarch) on May 09, 2003 at 04:39 UTC

    Theoretically, you should be able to do something similar on case sensitive systems.

    my @list = grep( -M < 1 } glob "$dir/b*.txt $dir/B*.txt";

    I say theoretically as I don't such a system to test it on, but the multiple args in a string seems to work ok. Of course if its not just the 'B' that can vary case, then enumerating all the Txt TXt TXT tXT txT TxT tXt etc. isn't going to shorten anything:)


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller