in reply to How to extract the filenames in an array

If you want to find all the filename of a particular directory, you can use 'opendir' and 'readdir' function. For eg.
opendir(DIR, "/tmp") || die "can't opendir $!"; while (my $file = readdir(DIR)) { next unless (-f "/tmp/$file"); print $file."\n"; } closedir DIR;
If you want check a particular file name, you can use the '-e' option. For eg.
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
    The -e function checks for existence of a given path (among other functions which check for other things, of course).