Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks,
I have just wrote a converter and a simple wrapper that allows to convert all the files with the same extension in one go. The wrapper code as follows:
use warnings; use strict; my $input = shift; my @files; if ($input =~ /^\./) { @files = glob "*$input"; } else { @files = $input; } foreach (@files) { print "$_\n"; system("perl converter.pl $_"); }
It can read commands like:
perl wrapper.pl .wsNow I want to make the wrapper more powerful such that it can also read something like:
perl wrapper.pl test_*.wsThat means all files with name test_xxx.ws should be converted. How can I realize that?
Thanks a lot for your kind help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl glob
by talexb (Chancellor) on Nov 07, 2013 at 13:58 UTC | |
by Anonymous Monk on Nov 07, 2013 at 14:28 UTC | |
|
Re: perl glob
by hdb (Monsignor) on Nov 07, 2013 at 14:23 UTC | |
by Anonymous Monk on Nov 07, 2013 at 14:33 UTC | |
by afoken (Chancellor) on Nov 08, 2013 at 09:22 UTC | |
|
Re: perl glob
by Eily (Monsignor) on Nov 07, 2013 at 14:45 UTC | |
|
Re: perl glob
by hippo (Archbishop) on Nov 07, 2013 at 13:58 UTC |