in reply to Static Data ("__DATA__" vs. "our")
suppose you could set the file pointer using seek
One thing to watch out for -- the DATA filehandle is open to the original source file, so if you seek back to the beginning, you'll need to scan forward to the __DATA__ marker again to read the contents a second time.
You can use this to turn your script into a quine, that is, to enable it to print its own source code:
seek DATA, 0, 0; print <DATA> __DATA__
(I recently found this trick in the TinyWiki source code...)
|
|---|