Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: File::Find finding . and ..

by davorg (Chancellor)
on Jul 15, 2009 at 15:19 UTC ( #780356=note: print w/ replies, xml ) Need Help??


in reply to File::Find finding . and ..

next if($name =~ /[^\.]|[^\.\.]/g);

That really isn't doing what you think it is.

"If name matches a character that isn't a dot or a character that isn't a dot".

You probably meant something like:

next if ($name =~ /^(\.\.?)$)/);

But this is one of those cases where a regex is overkill.

next if ($name eq '.' or $name eq '..');

Update: And that next should really be a return.

--

See the Copyright notice on my home node.

Perl training courses


Comment on Re: File::Find finding . and ..
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2015-07-08 08:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (98 votes), past polls