'foobar' =~ /(oo)(bar)(?{$word=${-1}})/ [download]
In reply to Refer by relative way to regex group (eg. the last one) by Anonymous Monk