> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Date: Tue, 10 Dec 2002 15:38:58 -0800
> From: Rich Morin <[EMAIL PROTECTED]>
> X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/
> 
> On occasion, I have found it useful to cobble up a "little language"
> that allows me to generate a list of items, using a wild-card or some
> other syntax, as:
> 
>    foo[0-9][0-9]  yields foo00, foo01, ...
> 
> I'm wondering whether Perl should have a similar capability, using REs.

Why use regexen when you can just use junctions?

    my $foos = 'foo' ~ any(0..9) ~ any(0..9);

That's a bit shorter that the code sample I just wrote... not by much
though :-P.  Unfortunately, this one doesn't come in order, but a
C<sort> should fix that.

We have a I<powerful> language on our hands, people.

Luke

Reply via email to