>>> I can usually figure out regexes, and this one seems simple, but it still >>> eludes me-- >>> >>> I'm looking for a regex (or a couple of regexes) to do the following: >>> >>> blahblah{ab,abcd}blah --> blahblah(ab|abcd)blah >>> blahblah{a,b,c}blah --> blahblah(a|b|c)blah >>> >>> If it's not obvious I'm trying to glob-select files like the tcsh would. >>> I've got the rest, this is the last part... >> >> >> $var =~ s<{([^}]+)}><(?:@{[ ($a = $1) =~ y/,/|/; $a ]})>; > > Oops! As has been pointed out to me that won't work, however this will: > > $var =~ s<{([^}]+)}><(?:@{[ ($a = $1) =~ y/,/|/ && $a ]})>;
Does it not need the 'ge' at the end? I don't understand why you are creating an anonymous array with a single value, then dereferencing it... And what does the "?:" do? It's not in the search pattern so it doesn't look like a regex, and it doesn't look like a conditional either... And is this method any faster or more efficient than this? $var =~ s/\{([^}]+)\}/$v = $1; $v =~ s!,!|!g; qq!($v)!/ge; Thanks again. - Bryan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>