Perl/File::Next
From Wsms
parent Perl
[edit]
File::Next
File::Next is a CPAN module that lets you iterate through a directory tree.
#!/usr/bin/env perl
use warnings;
use strict;
use File::Next;
$|++;
# print names of all files in user's home directory
my $files = File::Next::files($ENV{"HOME"});
while ( defined ( my $file = $files->() ) ) {
print $file, "\n";
}
[edit]
installation
Install from CPAN using:
root@mckinley:~# perl -MCPAN -e 'install File::Next'
In case you forgot, I show how to use CPAN at 20070301a#Installing_Perl_Modules_on_Linux.
If this is the first time you are using CPAN, you may have to install some additional programs such as lynx.
[edit]
