in reply to Re: Re: File Find question
in thread File Find question

As far as I can tell the second snippet I posted will do what you want. If it doesn't, you haven't been clear enough.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re^3: File Find question
by Anonymous Monk on Nov 06, 2002 at 20:38 UTC
    Thanks I got it to work this way (and your map function answer works great also) but was hoping I could get it more condensed without using the map function. Just so I can understand it better since I am a beginner. Anyway to combine what I have here to work??
    #!/usr/local/bin/perl use strict; use File::Find; my $dirs = '/web/directory/AA'; my $dirs2 = '/web/directory/BB'; my $dirs3 = '/web/directory/CC' find(\&search, $dirs); find(\&search, $dirs2); find(\&search, $dirs3); sub search { print "$File::Find::name\n"; }
      Yes. find(\&search, $dirs, $dirs2, $dirs3); Which should actually be
      my @dirs = ('/web/directory/AA', '/web/directory/BB', '/web/directory/ +CC',); find(\&search, @dirs);
      Which can be written as my @dirs = map "/web/directory/$_", 'AA', 'BB', 'CC'; Which we can then embed in the function call: find(\&search, map "/web/directory/$_", 'AA', 'BB', 'CC'); :)

      Makeshifts last the longest.