$ perl -e 'print $1 if "foobar" =~ m{f(oo)ba}' oo $ perl -e 'print $1 if "foobar" =~ m#f(oo)ba#' oo