I am new to perl. I would like to look into every directory below my home directory and look for files in it.

#!/usr/bin/perl

#use strict;
use Cwd;

my $curr = cwd();
opendir(CURRDIR, $curr) or die "can't open directory ($!), exiting.\n";

my @files = readdir(CURRDIR);
#closedir(CURRDIR);

foreach my $file (sort @files) {

 next if $file eq '.' || $file eq '..';
 next if !-d $file;

if (-d $file) {
print "$file/\n"; #Puts a slash in front of every directory it encounters
}
else { print "$file\n"; }


}

Any Help would be greatly appreciated.



_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to