in reply to Re^2: Producing 2 lists from a grep call
in thread Producing 2 lists from a grep call
to implement this code properly, you must test for both -d, and -f, and ignore the rest. add next unless -d $_ or -f _; before the push statement and you'll have what you're looking for.
Update: changes as per Screamerfor (readdir DIR) { next if $_ eq '.' or $_ eq '..'; next unless -d $base . '/' . $_ or -f _; push @{ -d $base . '/' . $_ ? \@dirs : \@files }, $_; }
Update 2: for more info on filetests, see -X under perlfunc
~Particle *accelerates*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Producing 2 lists from a grep call
by Aristotle (Chancellor) on Jun 17, 2002 at 12:35 UTC |