I'd suggest a small tweak to that:
@files = grep {-f "$dir/$_" && /\.xml$/i} readdir DIR;Because otherwise the regular expression would have matched a file named "fooxml.bar" as well. Also, this now matches the extension case-insensitively, just in case.
In reply to Re^3: Perl List files in directory
by Anonymous Monk
in thread Perl List files in directory
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |