Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: getting files names

by cengineer (Pilgrim)
on Apr 27, 2007 at 14:17 UTC ( #612383=note: print w/replies, xml ) Need Help??


in reply to getting files names

Hope this helps
my $files = dirlist($someDirectory); foreach my $fileInDirectory (@$files) { dosomething($fileInDirectory); } sub dirlist { my $dir = shift; my @filelist; opendir(DIR, $dir) or die "can't opendir $dir: $!"; while (defined(my $file = readdir(DIR))) { # Skip "." and ".." next if ($file =~ /^\.\.?$/); push(@filelist, $file); } closedir(DIR); return \@filelist; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://612383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2023-12-06 05:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (29 votes). Check out past polls.

    Notices?