in reply to usage of find::file and glob to filter out directories and retrieve selected files

See Beginners guide to File::Find

see one more small example :-

#!/usr/bin/perl -w use strict; use File::Find; print "Enter the directory to start searching in: "; chomp(my $dir = <STDIN>); # find takes a subroutine reference and the directory to start working + from. find (\&wanted, $dir); sub wanted { if(/\.pl$/) { # See if it’s a .pl file print "$File::Find::name\n"; # Print the current file name. } }

For each file found, certain variables are set.
• $_ is set to the name of the current file.
• $File::Find::dir is set to the directory that contains the file.
• $File::Find::name contains the full name of the file, i.e. $File::Find::dir/$_.

Also have a look at File::Find::Rule- Alternative interface to File::Find

  • Comment on Re: usage of find::file and glob to filter out directories and retrieve selected files
  • Download Code