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?
In reply to Re: Perl List files in directory
by Anonymous Monk
in thread Perl List files in directory
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |