in reply to This is why Perl is so frustrating

A more concise and (possibly) clearer way to code the test is:

for my $file (@filenames) { next if $file =~ /^\.\.?$/; ... }

note too the early 'exit' from the current loop iteration to avoid a level of nesting and make flow clearer.


True laziness is hard work

Replies are listed 'Best First'.
Re^2: This is why Perl is so frustrating
by JadeNB (Chaplain) on Jul 29, 2009 at 23:36 UTC
    $file =~ /^\.\.?$/
    Or $file =~ /^\.{1,2}$/ (which is easier to extend later if one decides also to treat ... and friends specially! :-) ).