Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: die functionby GhodMode (Pilgrim) |
on Aug 02, 2006 at 06:02 UTC ( [id://565172]=note: print w/replies, xml ) | Need Help?? |
You've got two questions there. I'm not sure I understand the first one, and I don't use eval much. So, I'll just try to answer the second one. By default, die adds the file name and line number to the end of whatever message you give it, but it takes it off if the message has a newline (\n) at the end. If you want to put the information somewhere in the middle of the message, the tokens __LINE__ and __FILE__ are the line number and filename. Use them like constants (outside of any quotes). $0 also contains the file name. If you're in a subroutine, you can use the caller function, which, if used in a list context, returns the package, file name, and line number that the current subroutine was called from. -- -- GhodmodeBlessed is he who has found his work; let him ask no other blessedness. -- Thomas Carlyle
In Section
Seekers of Perl Wisdom
|
|