Reputation: 8602
How do I recursively include subdirectories in an array using glob?
I currently have my @files = glob $PATH . '/*';
(where $PATH = "."
) but this does not include subdirectories.
Upvotes: 1
Views: 5546
Reputation: 26121
If you like to stick with standard modules you can use this code.
use strict;
use warnings;
use File::Find;
my @files;
find( { wanted => sub { push @files, $_ }, no_chdir => 1 }, $PATH );
Upvotes: 1