in reply to Does perl read the entire pl file into memory?

> when it encounters the __END__ then it stops reading?

Right this happens at compile time and DATA° is exactly that filehandle which points there.

That's why you can continue reading from <DATA> or use seek to set DATA back and read the source again. ( better not at compile time though ;)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

°) there is a minor difference between DATA and END which doesn't matter in this case.

See perldata#Special-Literals

Replies are listed 'Best First'.
Re^2: Does perl read the entire pl file into memory?
by harangzsolt33 (Deacon) on May 21, 2019 at 20:05 UTC
    Thank you for all your replies! You were all very helpful and great point. I'll probably keep the comments section at the end separate from my perl script. ;)

      Let me add: please do not use literal comments. Use POD (and there are several other tutorials around). It's easy, it's relatively powerful, it reads fine raw, and various formatters know how to display it nicely.