-start-
> "Ben Hambidge" <[EMAIL PROTECTED]>
>at 05/24/2000 03:22 AM
>I have the following condition:
>if ( $x =~ /^[one|two|three|four]/ ) { ...}
I think you mean /^(?:one|two|three|four)/
>However, I would like to test for values in an array; for example:
>@array = ( "one", "two", "three", "four" );
>Can I now write the regexp to pull out the values of the array instead,
>making the regexp flexible depending on the values in the array at the
>time?
my @array = qw(one two three four);
my @patterns = map { qr/^$_/ } @array;
foreach (@patterns) {
something() if $string =~ /$_/;
}
Grant Hopwood.
Valero Energy Corp.
(210)370-2380
PGP Public Key: Ldap://certserver.pgp.com
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]