PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
I have YAEP - yet another efficiency problem (but you could also think of it as "Yet another elegance problem"): I'm doing a glob expansion of a list. let's say you have a list @params and this contains some filename globs. You'd like to expand this list to be explicit. i.e.
So ok. What I'm doing right now is:(*.txt *.aux) -> (file1.txt file2.txt file1.aux file2.aux)
and then just @param = &globlist(@param); Waaah. Bad solution. I know it - I feel it. Much copying way too much overhead, too much code. I'd like to walk through the list and modify it without copying the expanded data to a new one. But when I try splice to do that, I get lost with the index.sub globlist { my @back; foreach my $elem (@_) { push @back, (glob $elem); } return @back; }
Does anyone of you know the right path to listglobing?
Bye
PetaMem
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(MeowChow) Re: Listglob
by MeowChow (Vicar) on Apr 17, 2002 at 10:52 UTC | |
|
Re: Listglob
by strat (Canon) on Apr 17, 2002 at 10:21 UTC | |
|
Re: Listglob
by ariels (Curate) on Apr 17, 2002 at 13:18 UTC | |
|
Re: Listglob
by tachyon (Chancellor) on Apr 17, 2002 at 12:46 UTC | |
by merlyn (Sage) on Apr 17, 2002 at 18:40 UTC | |
by tachyon (Chancellor) on Apr 17, 2002 at 19:30 UTC | |
by ignatz (Vicar) on Apr 17, 2002 at 19:53 UTC | |
by merlyn (Sage) on Apr 17, 2002 at 20:00 UTC | |
|
Re: Listglob
by Zaxo (Archbishop) on Apr 17, 2002 at 19:12 UTC | |
by merlyn (Sage) on Apr 17, 2002 at 23:36 UTC | |
by theorbtwo (Prior) on Apr 17, 2002 at 23:44 UTC | |
by jsprat (Curate) on Apr 18, 2002 at 01:12 UTC |