in reply to Re^2: How do I read files in a directory and not directories?
in thread How do I read files in a directory and not directories?

yeah, good point. i actually almost wrote it as my @tags = grep {defined $_} map { ... } @files; (though i like the ? $1 : () much better).. left it out because, in theory, it should never not match, and if it does fail to match, perhaps (no clue if he does or not) OP wants to trap those cases ...
foreach my $tag (@tags){ die "found a blank" unless defined $tag; .... }
(though i guess in that case you can't, very easily, tie the failing tag back to an offending file ... hm.)

Replies are listed 'Best First'.
Re^4: How do I read files in a directory and not directories?
by ikegami (Patriarch) on Mar 10, 2006 at 20:13 UTC
    If you remove the undefs, you can still trap that case by using if (@files - @tags)