http://qs1969.pair.com?node_id=1177481


in reply to Re: How to perform recursion in any OS?
in thread How to perform recursion in any OS?

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 /"?