in reply to Perl List files in directory
In your Option 2, try my @files = glob("/opt/tmp/*");, otherwise you'll only get files that include a dot in the name.
In your Option 3, the opendir line should be: opendir(DIR, "/opt/tmp/") or die "Cannot open dir"; (misplaced closing paren). Also, the grep causes @files to only include "text" files (see documentation of -T in -X), is that what you want?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl List files in directory
by Anonymous Monk on Apr 22, 2014 at 10:46 UTC | |
by Anonymous Monk on Apr 22, 2014 at 12:26 UTC |