in reply to How to extract the filenames in an array
If you want check a particular file name, you can use the '-e' option. For eg.opendir(DIR, "/tmp") || die "can't opendir $!"; while (my $file = readdir(DIR)) { next unless (-f "/tmp/$file"); print $file."\n"; } closedir DIR;
my $fname = "/tmp/test.txt"; print $fname if(-e $fname);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to extract the filenames in an array
by parv (Parson) on Sep 17, 2008 at 05:30 UTC |