Note that I'm using {} as delimiters for the main s///, and that what looks like an inner block of code is the replacement portion. The e option causes it to be eval'd.foreach (@array) { s{/(MSS.*?)/} { my $m=$1; $m=~s/ +([^*])/$1/g; $m}ge; }
Within the eval section, I operate on the matched string, and replace any spaces that are followed by something other than a * with whatever they are followed by.
Without the +, it would squeeze multiple spaces into one space, when followed by a *, and if not followed by a *, it would (of course) remove them all.
In reply to Re: How do I match for a pattern in an array element delimited with a /
by Roy Johnson
in thread How do I match for a pattern in an array element delimited with a /
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |