my @abbrs = qw( Ut ); my @strings = qw( abcd ); for $abbr ( @abbrs ) { for $str ( @strings ) { $str =~ s/<$abbr(.*)>/<$abbr>/; } }