in reply to Using @{"_<$filename"}
From my limited understanding of how Perl works I doubt it is possible to get the original text that comprises your program at runtime without directly reading the source file. The logic for this assertion is based on how Perl actually executes the textfile that contains your code.
When you run a Perl program this is what happens:
0. First the Perl executable reads textfile that comprises your code.
1. Next comes: The Compilation Phase which converts your textfile program into a data structure called a parse tree. During this process it discards superfluous elements like whitespace and comments.
2. Next it moves on to the optional Code Generation Phase.
3. Next comes: The Parse Tree Reconstruction Phase where it reanimates the program by reconstructing the parse tree. This too is optional and occurs only if the phase 2 code generation occurs and you chose to generate bytecode.
4. Finally comes: The Execution Phase where the interpreter takes the parse tree data structure and executes it. This is runtime. Because it executes the parse tree data structure rather than the original textfile you think of as your program, when your program runs it is in the form of Perl's internal opcodes not the original code that generated them.
I would therefore suggest that what you want to do may not be possible as the source code that you wish to get no longer exists per se. It is still in the source file but is not being used by Perl in its original form anymore.
Chapter 18 of the Camel (3rd ed) goes into this in more detail. Thankfully I don't have to understand this to write Perl code - otherwise I would be stuffed because I don't!
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|