in reply to Combining two Reg Expressions with substitution

Sure there is.
use strict; use warnings; my $string = 'gregarious gregarious gregarious'; my $count = 0; $string =~ s/gregarious/$count++ ? "\\underline{gregarious}" : "\\foot +note{gregarious}"/ieg

-enlil