in reply to Yet another problem with recursive code
What is that $ARGV[0]=~/-all/ doing out there? Do you want an && or and in there? Also:if (defined (@ARGV) $ARGV[0]=~/-all/) { $mode="all"; } else { $mode=""; }
You're not chdiring into $file first, nor are you passing that to &scandir, so it looks to me like it's just going to repeat itself in the current directory/context again.if (-d $file) { &scandir;
You're also calling &scandir twice in your code.. once towards the top and once at the bottom (for "."). Not sure if you intended to do that or not.
It looks to me like you need to figure out how you're wanting your functions to be called, and perhaps re-work the way you're passing arguments around.
Take a look at File::Find and File::Recurse also.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Yet another problem with recursive code
by tye (Sage) on Nov 10, 2000 at 04:51 UTC |