develooper Front page | perl.perl5.porters | Postings from January 2015

Re: [perl #123691] Feature: A variation of glob() which uses regexps

Thread Previous | Thread Next
From:
Eric Brine
Date:
January 29, 2015 16:23
Subject:
Re: [perl #123691] Feature: A variation of glob() which uses regexps
Message ID:
CALJW-qHG1FhjpQF-gzrVapKsOhkDOOmA23+-xsGVe5o6im1CSg@mail.gmail.com
On Thu, Jan 29, 2015 at 6:51 AM, James E Keenan via RT <
perlbug-followup@perl.org> wrote:

> On Wed Jan 28 10:39:13 2015, porton@narod.ru wrote:
> > I suggest to add to Perl core a routine similar to glob(), but
> > using regexps instead of globs.
>
> But that functionality already exists, does it not?
>
> (untested)
> #####
> opendir my $DIR, 'some/directory' or die;
> my @files = grep { m/some_pattern/ } readdir $DIR;
> closedir or die;
> #####
>

glob is both a filtered file fetcher (glob('*.txt')) and string generator
(glob('{a,b}')).

You covered the former. If he wants the latter, there's Regexp::Genex.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About