Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: How to perform recursion in any OS?

by betterworld (Curate)
on Dec 08, 2016 at 07:48 UTC ( #1177481=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1177481]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2022-12-03 08:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?