in reply to Recursively run another script

use strict; use File::Find; my $action = shift; find(sub { return unless -f; system($ARGV[0], $_) == 0 or warn "Non-zero exit code for $_"; }, @ARGV);

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: Recursively run another script
by bean (Monk) on Aug 08, 2003 at 06:14 UTC
    Ok. Um - yes. That is *way* more elegant than my code.

    However, my code has no dependencies - which is important to me, at least, because (for reasons I'd rather not go into because they're bad for my blood-pressure) I can't use modules at work, which is where I use the code.
      File::Find has been in the Perl core distribution forever. That's not a dependency any more than requiring a perl interpreter is a dependency.

      Makeshifts last the longest.

      You code is quite dependant on os. If you wanted to avoid file::find you should at least use opendir to get your file list. But really in the end you'll be much better off if you get comfy with file::find