The begincheck program makes it all clear, eventually:
#!/usr/bin/perl # begincheck print " 8. Ordinary code runs at runtime.\n"; END { print "14. So this is the end of the tale.\n" } INIT { print " 5. INIT blocks run FIFO just before runtime.\n" } CHECK { print " 4. So this is the fourth line.\n" } print " 9. It runs in order, of course.\n"; BEGIN { print " 1. BEGIN blocks run FIFO during compilation.\n" } END { print "13. Read perlmod for the rest of the story.\n" } CHECK { print " 3. CHECK blocks run LIFO at compilation?s end.\n" } INIT { print " 6. Run this again, using Perl?s -c switch.\n" } print "10. This is anti-obfuscated code.\n"; END { print "12. END blocks run LIFO at quitting time.\n" } BEGIN { print " 2. So this line comes out second.\n" } INIT { print " 7. You?ll see the difference right away.\n" } print "11. It merely _looks_ like it should be confusing.\n" +;
In reply to Re^2: perl 5.16.3 + Tk 804.031 core dumps on syntax check when a window is made in BEGIN block
by ohcamacj
in thread perl 5.16.3 + Tk 804.031 core dumps on syntax check when a window is made in BEGIN block
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |