I prefer Path::Class for listing directories:
use Path::Class qw(dir); my @files = map {$_->basename} dir($path)->children;
Also check out the docs (perldoc Path::Class::Dir) about the "recurse" function.
In any case, there are many other reasons why you should never write code like `ls -a $path`. Have you thought about the possibility that $path includes the string "; rm -rf /"?
In reply to Re^2: How to perform recursion in any OS?
by betterworld
in thread How to perform recursion in any OS?
by rollec
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |