$foo =~ s/ \<\% # any left doohickey .*? # minimum span of junk \%\> # first right doohickey //xg;