No such thing as a small change | |
PerlMonks |
Can / Do BEGIN blocks return their evaluated content?by dynamo (Chaplain) |
on Dec 21, 2007 at 18:20 UTC ( [id://658491]=perlquestion: print w/replies, xml ) | Need Help?? |
dynamo has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monks,
I've thinking about the BEGIN block today - and whether or not it returns it's contents. I did a quick experiment that doesn't really conclude anything except that perl doesn't want to play along. Here is what I'm simulating: And here's how I think it should be able to work: But I get this error: Can't call method "BEGIN" without a package or object reference at timemachine.pl line 4. Is there a way to make it do what I want? What exactly is it complaining about there? I tried doing it inside a package, but alas. It was to no avail. Your thoughts would be appreciated.
Back to
Seekers of Perl Wisdom
|
|