Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Overhead of __DATA__?by stefp (Vicar) |
on Sep 05, 2001 at 02:36 UTC ( [id://110187]=note: print w/replies, xml ) | Need Help?? |
There is less overhead than storing data in a separate file.
No seek necessary because the filehandle is already at
the right position after the script compilation.
Also, if
your data section is very long and never explicitely
accessed using the DATA handle, it will
never be loaded from the disk (except the beginning
by normal read-ahead of the OS). In fact if you "rewind" it by seek( DATA, 0, 0) than do print <DATA> you do print the whole script:
note to refute a remark on the CB To my own surprise: you can pipe this script to Perl and you will get the same result as executing it from a file because of the IO buffering. Indeed, the perl seek() does not translate on a seek() system call. So, if buffering permits, you can perl-seek a non seekable stream!!! -- stefp
In Section
Seekers of Perl Wisdom
|
|