Ugh. You can use @1 and @2 if you are masochistic, but please don't make us read code like that. It's hideous.
That said, I think you are trying to do this:
Notice that there is no reason for a separate if statement. The substitution only takes place if it can.my @abbrs = qw( Ut ); my @strings = qw( abcd<Utly> ); for $abbr ( @abbrs ) { for $str ( @strings ) { $str =~ s/<$abbr(.*)>/<$abbr>/; } }
-sauoq "My two cents aren't worth a dime.";
In reply to Re: replacing strings using reg exp
by sauoq
in thread replacing strings using reg exp
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |