Frank McCollum wrote: > > I am not getting the Find Function. (FILE::FIND). I have found all of > these great examples on the web describing how to use the find function > under the following two conditions... > > 1) You know the exact File Name you are looking for, or you just want a > list of every file in a directory > 2) You only want to print out some data in the &wanted routine. > > Does any one have some examples that would help me to do this: > 1) Search a directory for a partial filename (i.e. "Inven" would return all > files similar to "Inventory.pdf", etc.)
If you are only searching a single directory (no subdirectories) then use glob() or opendir()/readdir()/closedir(): my @files = glob 'Inven*'; # OR my @files = <Inven*>; # OR opendir DIR, '.' or die "Cannot open the current directory: $!"; my @files = grep /^Inven/, readdir DIR; closedir DIR; If you have to search through all subdirectories: use File::Find; my @files; find( sub { push @files, $File::Find::name if /^Inven/ }, '.' ); > 2) Return the entire list of paths/filenames that match so I can fool around > with the files some more. See above. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]