On Mon, May 18, 2009 at 18:40, AndrewMcHorney <andrewmchor...@cox.net> wrote:
> Hello
>
> I looked at the documentation for this function and I find it confusing.
> What do you pass in to get all the files on drive letter c?
snip

find \&wanted, "c:/";

will run the wanted function once for every file and directory on the
c drive.  An easy way to create function for find is to use an
anonymous subroutine:

find sub {}, "c:/";

If you want to limit the function to files you can check to see if the
current item is a file or not with -f:

find sub {
    return unless -f;
    print "$File::Find::name\n"
}, "c:/";

That code prints out every filename (with path) on the c drive.  The
function returns if the current item is not a file to avoid the print.


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to