in reply to Re: Upper / Lower case extensions
in thread Upper / Lower case extensions

Good one, Zaxo!

If odd cases like Dat, dAt, and other such silliness might exist, you could also use:

my @datafiles = grep { -f } glob("$basepath$ARGV[0]/$ARGV[1].{d,D}{a,A}{t,T}");
But if you only have to deal with all upper or all lower case, Zaxo's answer is better.
--
Mike

Replies are listed 'Best First'.
Re: Re^2: Upper / Lower case extensions
by sauoq (Abbot) on Jul 31, 2002 at 09:12 UTC
    I suggest:
    my @datafiles = glob("$basepath$ARGV[0]/$ARGV[1].[dD][aA][tT]");

    It takes care of the special cases and eliminates the grep.

    Figuring out why it eliminates the grep is an exercise for the reader. :-) Hint: You might need to use man instead of perldoc. . .

    -sauoq
    "My two cents aren't worth a dime.";