$x = $y = "apple"; "orange" =~ /(.*)(?{$x = $^N; local $y = $^N})/; print "$x\n$y\n"; __END__ orange apple