in reply to Re: list of fles in a directory, but use wildcards like *
in thread list of fles in a directory, but use wildcards like *
To continue with Limbic~Region's nit, file names can even have newlines at the end, in which case using $ will cause the regex to match, for example, "onlythese1.txt\n". It will rarely if ever happen, but I tend to use \z to match the literal end of string, just in case.
my @files = grep { /^onlythese.*\.txt\z/s } readdir DIR;
-- Mike
--
XML::Simpler does not require XML::Parser or a SAX parser.
It does require File::Slurp.
-- grantm, perldoc XML::Simpler
|
|---|