You need tp pass starting directory to argument to your program "prog.pl
c:\"

might also consider ...

> #!/bin/perl
>
> use strict;
> use Cwd;
>
> my ($startpath, $cwd, $startat, $list);
>
> $startpath = $ARGV[0];
> $cwd = getcwd();
>
> chdir $startpath;
> $startpath = getcwd();
>
> sub godown($@);
 ..dont think you need this anymore...
> &godown($startpath);
 ...this would be beter as,
    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;
>     }
> }



----- Original Message -----
From: "Anthony Kong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 14, 2003 4:37 AM
Subject: find2perl


> 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]
>


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

Reply via email to