http://qs1969.pair.com?node_id=780356


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