Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6054155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:07:17+00:00 2026-05-23T08:07:17+00:00

So, I recently noticed a use of opendir in a script, and would like

  • 0

So, I recently noticed a use of opendir in a script, and would like to change it slightly so that it returns files in the subfolders of a directory as well as files in the directory itself. After investigating, I haven’t been able to find any sort of recursive option for opendir, and have had trouble getting glob to return a scalar. So, rather than fudge around with either one more, I figured it would be more prudent to just ask: what is the standard way to get a handle to all files in a dir and its subdirs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:07:17+00:00Added an answer on May 23, 2026 at 8:07 am

    The classic way is with File::Find, which has the advantage of being a core module, but it can be a bit of a pain. If you’re able to use a third-party module, File::Util is quite handy:

    use File::Util;
    my $fu = File::Util->new;
    
    my $root = 'foo/bar';
    
    my @dirs_and_files = $fu->list_dir($root, '--recurse');
    my @files_only     = $fu->list_dir($root, '--recurse', '--files-only');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed recently that the project files my text editors use (along with some
I have a few forms that use tiny mce. I have noticed recently that
I have recently noticed that a lot of JavaScript files on the Web start
At my company we recently noticed that one developer was not using language files
I recently noticed that on my system it is not possible to require 'lib/file.pl'
I recently noticed that colors are now displaying darker on iPhone than their actual
I've recently noticed that things accommodate differently on the simulator and a real device
Recently I noticed that when I am converting a list to set the order
I recently noticed that there are several bigint type fields in one of my
I recently started working in VS2010 and noticed right away that the font I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.