in reply to File::Find complain about invalid top directory?
1) you mispelled my $num_pahts = 0.
2) you're incrementing your count before you're adding an element to the array. Your array starts with 0, and $paths[0] is empty and when it tries to shift the element off of there and there's nothing there, it tells you that there's an invalid dirctory. I'd also suggest looking into push to fill your array.
Hope this helps..
Rich
Addition: While I'm at it, I'll give you some other pointers.
1) Instead of counting the elements in @ARGV, you could just do this:
push @paths, <$path/*> unless @ARGV;
2)If you really wanted to find out how many elements there were (which you really don't need here), you could just put @ARGV in scalar context. But remember, the top element is one less than that because arrays start with 0.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: File::Find complain about invalid top directory?
by slok (Acolyte) on Apr 22, 2001 at 04:38 UTC | |
by rchiav (Deacon) on Apr 22, 2001 at 05:45 UTC |