Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: $File::Find::prune

by btrott (Parson)
on Mar 09, 2001 at 13:16 UTC ( [id://63205]=note: print w/replies, xml ) Need Help??


in reply to $File::Find::prune

This is just an error in your logic, basically. What you want is probably:
if ($File::Find::name =~ m!^/some_dir/sub_dir!) { print "skipping $dir\n'; $File::Find::prune = 1; return; }
In other words, test $File::Find::name, not $File::Find::dir. When process gets called, dir holds the name of the *containing* directory. So when process gets called for the entry "/some_dir/sub_dir", dir is "/some_dir". You're expecting it to be "/some_dir/sub_dir", but it's not that until you've actually descended into "sub_dir". So you're skipping all the entries below "sub_dir" but not descending into "sub_dir" itself.

Make sense?

By the way, "$dir/$_" is just $File::Find::name. I think.

Replies are listed 'Best First'.
Re: Re: $File::Find::prune
by greenFox (Vicar) on Mar 09, 2001 at 13:43 UTC
    $File::Find::name was it :) thanks to yourself and Tyke who tried to point me in the right direction though I still managed to keep looking at $File::Find::dir and scratch my head wondering :) . Cheers.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://63205]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-23 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found