On Sat, Jun 7, 2008 at 11:30 PM, moroshko <[EMAIL PROTECTED]> wrote: > Hello experts ! > > What is the most efficient way to get a list of all file names (a full > path) in a certain directory ? > This should work recursively and include only files (not directories).
Hi, Just show a way. The codes below, use Filesys::Tree qw/tree/; my $tree = tree({ 'full' => 1,'max-depth' => 3,'pattern' => qr/\.pl$/ } ,'.'); files($tree); sub files { my %tree = %{+shift}; for (keys %tree) { if ($tree{$_}->{type} eq 'f'){ print $_,"\n" }elsif ($tree{$_}->{type} eq 'd') { files($tree{$_}->{contents}); } } } should get what you wanted. It's the same as this unix command do, $ find . -type f -name "*.pl" -maxdepth 2 HTH. -- Jeff Peng - [EMAIL PROTECTED] Professional Squid supports in China http://www.ChinaSquid.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/