$^S: is inside eval
if ($^S) { print "Inside eval.\n"; } else { print "Outside eval.\n"; } eval { if ($^S) { print "Inside eval.\n"; } else { print "Outside eval.\n"; } }