in reply to Re: Memory Usage with __DATA__
in thread Memory Usage with __DATA__
Its interesting to note that the DATA file handle only gets initialized when there an __END__ or __DATA__ tag is present, if they are omitted the filehandle isnt created. Try this:
use strict; use warnings; while (<DATA>) { print } print "--\n"; seek(DATA,0,0); while (<DATA>) { print } # uncomment the data block for this program to work #__DATA__ #test #test
which outputs
readline() on unopened filehandle DATA at D:\perl\scratch\test__data__ +.pl line 3. seek() on unopened filehandle DATA at D:\perl\scratch\test__data__.pl +line 7. readline() on unopened filehandle DATA at D:\perl\scratch\test__data__ +.pl line 8. --
So presumably whatever memory consumed by the filehandle can be avoided if that makes a difference. I doubt it if it does.
|
|---|