Perldoc is your friend here.
From your $dir path, looks like you are on windows. So go to a DOS prompt, enter:
perldoc -f readdir
and you will see by happy coincidence as the example in the last paragraph an answer to your question:
-------------------------If you're planning to filetest the return values out of a "readdir", you'd better prepend the directory in question. Otherwise, because we didn't "chdir" there, it would have been testing the wrong file.
opendir(DIR, $some_dir) || die "can't opendir some_dir: $!"; @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR); closedir DIR;
Just replace the ^\. with ^xxxx and your job is done, like:
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; @xxxx = grep { /^xxxx/ && -f "$some_dir/$_" } readdir(DIR); closedir DIR; print "@xxxx";
Live in the moment
In reply to Re: readdir
by Speedy
in thread filtering readdir()'s results
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |