Hi Ben,

Not sure I get your point... but this is what it sounds like to me.

I have a script, and I want to feed it a special thing to let it know that
any character (A-Z or a-z does upper lower case matter?) is valid, but I
also want to use other characters at the same time. So ./script.pl -s ABC is
valid but also ./script.pl -s AB<any character>DEF is valid.

In most operating systems this is done by the * or the ? character *
representing 1 or infinite characters an ? 1 character.

So to keep with the general style of things and keep the learning curve as
low as possible you could just say that * you do not use because this would
cause an infinite number of possible characters, combinations and
permutations which is kind of pointless unless you want the script never to
return any real results. So only ? then so something like this
./script.pl-s l??p would result in the words leap, loop, pool etc...

So all you need to do is simply say in case I see the character ? treat this
as [a-z] or [a-zA-Z] in your regex and you should be fine. A if ( $character
eq '?' ) { $character = '[a-zA-Z]'; } should do the trick.

I guess I am thinking to simple here or simply misunderstanding the problem
as it seems simple enough. It would work if you could for instance post a
bit of example code so the list can see what you are up to, sometimes a few
lines of code can say more then a thousand words ;-)

Regards,

Rob




On Tue, Mar 8, 2011 at 9:42 PM, Ben Lavery <ben.lav...@gmail.com> wrote:

> Hi all,
>
> I have a script which takes a string of alphabetic characters as an
> argument, generates all combinations of the characters and all permutations
> of the combinations, then looks up each result in a list of valid words, if
> the result is a valid word it gets stored in an array.
> I would like to be able to specify "any alphabetic character" from the
> command line.  Is there a clean way of doing this?  I thought that I could
> search the string for such characters and cycle through all legal
> combinations, but this does seem particularly clean...
>
> I've had a look about and found lots of things about using wildcards from
> the command line that the shell deals with, but nothing about using a
> wildcard or otherwise inside a script which was declared on the command
> line...
>
> Many thanks for your time,
>
> Ben
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to