$ perl -e'"ab" =~ /((\w+)(?{print defined $^N ? "\$^N=$^N\n" : "\$^N not defined\n"})){2}/;' $^N=ab $^N not defined $^N=b