www.perldoc.com  search for File::Find.  It does the recursion for you!

"Prasad Karpur" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am new to Perl and would like to know how to look into every
subdirectory. Any help would be greatly appreciated.
>
> #!/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"; }
>
> }
>
>
> closedir(CURDIR);
>
>
> __________________________________________________________________
> The NEW Netscape 7.0 browser is now available. Upgrade now!
http://channels.netscape.com/ns/browsers/download.jsp
>
> Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/



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

Reply via email to