in reply to How to pattern match filenames in readdir?

If you don't need a complex regex, then globbing works too:
while (<*BLAH*>) { my $file = $_; # Do stuff with file }

Replies are listed 'Best First'.
Re: Re: How to pattern match filenames in readdir?
by nkpgmartin (Sexton) on Jun 05, 2001 at 21:41 UTC
    I got the following to work:
    my @file = grep {/BLAH/} readdir (DIR); foreach $file @file { do something; }
    Thanks for your help!