in reply to /foo${re}bar/

The {} are used to disambiguate the variable name from the surrounding text. If it were simply /foo$rebar/, perl would look for a variable named $rebar instead of $re.