in reply to Re: How do I read files in a directory and not directories?
in thread How do I read files in a directory and not directories?
my @tags = map { /(.{36})\.txt$/ ? $1 : undef } @files;
should be
my @tags = map { /(.{36})\.txt$/ ? $1 : () } @files;
or else you'll end up with a bunch of undefs in @tags.
>perl -le "print 0 + map undef, 1..2 2 >perl -le "print 0 + map { () } 1..2 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How do I read files in a directory and not directories?
by davidrw (Prior) on Mar 10, 2006 at 20:09 UTC | |
by ikegami (Patriarch) on Mar 10, 2006 at 20:13 UTC |