in reply to Regex for files
Hello bmcquill,
In addition to the references given above by GotToBTru, please see How-do-I-traverse-a-directory-tree of perlfaq5, and note that the module File::Find::Closures has a find_by_regex() method. For example (adapting the regex given above by aaron_baugher):
#! perl use strict; use warnings; use Data::Dump; use File::Find; use File::Find::Closures 'find_by_regex'; my ($wanted, $list_reporter) = find_by_regex( qr{ ^ messages (?:\.\d+) +? $ }x ); my @directories = ('test'); File::Find::find($wanted, @directories); my @files = $list_reporter->(); dd \@files;
Output:
13:18 >perl 1226_SoPW.pl ["test\\messages", "test\\messages.1", "test\\messages.345"] 13:19 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|