Using a heredoc would have the same effect with less magic, although the code layout would be different.
print "now in runtime...\n";
BEGIN {
open my $fh , '<', \<<'__EOI__' or die;
foo
bar
quux
now in runtime...
now in main
__EOI__
while (<$fh>) {
print "DATA: $_";
}
}
...