in reply to Perl6: Parting of @Arrayed See
I admit up front that at this point I am too lazy to read that thread right now but too impatient to wait with my question till later.
What I wonder is whether this can be used to supersede the rather unintuitive
Obviously one could say my (@dir, @other) = part [ -d, ! -d _ ] readdir DH; but I'd like to avoid the duplication. Maybe the following is possible? my (@dir, @other) = part [ -d, 1 ] readdir DH;my (@dir, @other); push @{ -d ? \@dir : \@other } for readdir DH;
That would work assuming that the second test will only catch elements not already caught by the first one. I'm not sure that would be ideal though - it would limit the use of part to mostly a "catch both grep". On the other hand, if it may copy any element to any number of result lists, that specific use would require redundant tests.
Hmm..
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Perl6: Parting of @Arrayed See
by mojotoad (Monsignor) on Dec 15, 2002 at 10:54 UTC | |
by Aristotle (Chancellor) on Dec 15, 2002 at 12:16 UTC | |
by BrentDax (Hermit) on Jan 10, 2003 at 18:30 UTC |