Traditionally, "the shell" does all the wildcard expansion, except on Windows. If you want to find files based on some wildcard expression, you can use the built-in glob function, the core module File::Find or File::Find::Rule if you want to write the search criteria in Perl.
Using glob() is the easiest way if you just want to search one directory for files specified by extension:
use strict; use File::Glob qw(bsd_glob); # switch on sane whitespace semantics for + glob my @files = glob('*.xml'); print "I found the following files:\n"; print "$_\n" for @files;
If you want to use File::Find, because you want to search a whole directory tree, it's also easy:
use strict; use File::Find; my @files; find(sub { push @files, $File::Find::name }, '.'); print "I found the following files:\n"; print "$_\n" for @files;
In reply to Re: File open
by Corion
in thread File open
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |