Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by betterworld (Curate)
on Dec 08, 2016 at 07:48 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2025-12-09 07:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (88 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.