I Must have some crazy silly mistake in my code or my understanding. I don't quite get my expected output from the following very short script.
### die.pl #!/usr/bin/perl use strict; use warnings; $SIG{__DIE__} = sub { print "In die: '@_'"; }; print "Hello!\n"; die "Hi"; print "Goodbye!\n"; ### Result: [duelafn@teckla]$ ./die.pl Hello! In die: 'Hi at ./die.pl line 6. Hi at ./die.pl line 6. '[duelafn@teckla]$
Two things did not happen as expected. First, I expected execution to continue to print "Goodbye!\n";. Second, I don't get where the double message is coming from.
Any ideas or suggestions?
Update: Missed the inability to cheat death. Thanks! Any thoughts on the double message? - both messages appear between my single quotes!
Update 2: Nevermind, figured out the double message. Quotes are in the right place if I disable buffering $| = 1. Thanks all!
Good Day,
Dean
In reply to $SIG{__DIE__} not working as expected by duelafn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |