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

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"; }

Replies are listed 'Best First'.
Re^5: File Find question
by Aristotle (Chancellor) on Nov 06, 2002 at 20:41 UTC
    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.