Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 romping around the Monastery: (8)
As of 2024-03-29 15:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found