|
|
How to process every file in a directory that matches a pattern - Perl
|
Views : 250
|
|
Tagged in : Perl
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
You can use the glob operator to get a list of all files in the current directory like this:
@files = glob("*.*");
foreach $file (@files) {
print "$file\n" if -f $file;
}
you can modify your glob pattern to get a list of all the filenames that end with .pl, like this:
# look for all *.pl files
@files = glob("*.pl");
foreach $file (@files) {
print "$file\n" if -f $file;
}
|
|
By - Nithya, On - 2010-02-04 |
|
|
|