The tokens __END__ and __DATA__ may be used to indicate the logical end of the script before the actual end of file. Any following text is ignored, but may be read via a DATA filehandle: main::DATA for __END__, or PACK- NAME::DATA (where PACKNAME is the current package) for __DATA__. The two control characters ^D and ^Z are syn- onyms for __END__ (or __DATA__ in a module). See Self- Loader for more description of __DATA__, and an example of its use. Note that you cannot read from the DATA filehan- dle in a BEGIN block: the BEGIN block is executed as soon as it is seen (during compilation), at which point the corresponding __DATA__ (or __END__) token has not yet been seen.You could consider to eval join('', <DATA>); at runtime, which may be useful for obfuscating and to avoid compile time warnings ;-)
Update: fixed typo.
--
Cheers, Joe
In reply to Re: reading the __DATA__
by joe++
in thread reading the __DATA__
by Ananda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |