The first two lines to match for the current or parent directory could be rewritten as next if $file =~ /^\.{1,2}$/;.
But it would be better not to, because it is a potential time-bomb waiting to explode. Why do people keep dragging out this broken regexp, when a couple of conditionals will do the trick?
next if $file eq '.' or $file eq '..';In reply to Re:x3 recurse directories and sub-directories (bad code warning)
by grinder
in thread recurse directories and sub-directories
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |