s{ # match and replace on $_ \b # start with a word boundary ( # capture the matches and store in $1 (?:[a-zA-Z0-9]+_)+ # letters and numbers followed by _ at least once [a-zA-Z0-9]+ # must end with letters/numbers ) \(\) # then () \b # followed by word boundary } { $1() # replace the matched text with this string } # substituting the value of $1 (the first capture) g # perform this replace on all matches in $_