http://www.perlmonks.org?node_id=1036708


in reply to Re^2: tracing system calls a perl script is making
in thread tracing system calls a perl script is making

What BrowserUk says - use INIT, not BEGIN, since BEGIN blocks are executed in the compile phase of the perl script.

I want to write something of a generic tracer for any perl script.

Why? GNU/Linux has tools for that ready - strace(1), ltrace(1). I suspect an XY problem here. What are you trying to to with that which you are ostensibly trying to do?

Then, perl is linked against many libraries, and it can well be that most of those syscalls happen inside calls to functions in these libraries. To verify that, you can use ltrace(1), which displays library calls, together with the -S switch to display system calls as well.