Hi, all,

I have used find2perl to generate a perl script. Upon execution it gives
these message:

Use of uninitialized value in chdir at test.pl line 52.
Use of chdir('') or chdir(undef) as chdir() is deprecated at test.pl line
52.

This find2perl comes with perl 5.8. 

Then I want to write a tree-transverse routine on my own. Here is the
listing:

============================================================================
=====
#!/bin/perl

use strict;
use Cwd;

my ($startpath, $cwd, $startat, $list);

$startpath = $ARGV[0];
$cwd = getcwd();

chdir $startpath;
$startpath = getcwd();

sub godown($@);

&godown($startpath);


sub godown($@){
    $startat = shift;
    print "$startat\n";

    if ( -d $startat && ! -l $startat){
        $cwd = getcwd();
        chdir $startat;

        my @list = glob("*");
        foreach my $f (@list){
            #if ( (-d $f) && (!-l $f) && ("$f" != ".") && ("$f" != "..") ){
            &godown ("$startat/$f") if -d "$startat/$f"
        }
        chdir $cwd;
    }
}

============================================================================
=====

But it does not work. Basically when godown() hit a leaf node (lowest level
directory) it just stopped there. Why the foreach loop cannot finish?




Regards,

Anthony





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

Reply via email to