Don't think so. You'd have to split $str on ',' and check each one individually.
Steve
[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object:erlDesignPatterns)[/small]
Here's a different way, that doesn't use a split, but the concept is almost the same as a split... Probably not what you need, but maybe it could help:
Code:
#!/usr/bin/perl -w
use strict;
my $group = "A,B,C,D" ;
my $str = "A,F,D,Z,B" ;
$str=~s/,/|/g;
my $re=qr($str);
my $matched=join(',' , $group=~/$re/g);
print "Matched on: $matched\n";
The output:
Code:
Matched on: A,B,D
Basically, I am converting the commas to pipes (the "OR" for a regex), and building a regex from that string.
Don't know if that works or not, but like I said, maybe a step in the right direction?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.