************************************************************************** * The following are notes for all the Perl tracing scripts, * * $Id: ALLperl_notes.txt 44 2007-09-17 07:47:20Z brendan $ * * COPYRIGHT: Copyright (c) 2007 Brendan Gregg. ************************************************************************** * Where did those "BEGIN" subroutine calls come from? The following counts subroutines from the example program, Code/Perl/hello.pl, # pl_subcalls.d Tracing... Hit Ctrl-C to end. ^C FILE SUB CALLS no subroutines were called, so there is no data to output. Now a similar program is traced, Code/Perl/hello_strict.pl, which uses the "strict" pragma, # pl_subcalls.d Tracing... Hit Ctrl-C to end. ^C FILE SUB CALLS hello_strict.pl BEGIN 1 strict.pm bits 1 strict.pm import 1 not only were functions from "strict.pm" traced, but a "BEGIN" function ran from the "hello_strict.pl" program - which doesn't appear to use "BEGIN", # cat -n ../Code/Perl/hello_strict.pl 1 #!./perl -w 2 3 use strict; 4 5 print "Hello World!\n"; Perl appears to add a BEGIN block to process the "use" keyword. This makes some degree of sense.