Not exactly a Perl question... (please at least mark as OT). Anyway, use one of strace,
truss, tusc, StraceNT, ... depending on platform.
Update: This node has gotten a higher reputation than I expected :)
So, as a kind of 'thank you!', and as there apparently exists
some interest in the issue, I decided to add some more value (well,
hopefully so). Sure, Google knows it all, too, but for easy quick reference...
strace — Linux
There is a companion tool ltrace for tracing calls to dynamic/shared libraries
truss — Solaris, AIX (newer versions)
Can trace library calls as well.
(On older versions of AIX (< v5.1, IIRC), you had to enable kernel tracing,
i.e. use some combination of trace, trcon, trcstop and trcrpt.
This was logging all system calls of the entire system, so you
had to postprocess the log to filter out what you were interested in.)
tusc — HP-UX
For older HP-UX boxen (10.20), there is a tool trace
par — IRIX
You almost always want the options par -s -SS —
But who uses IRIX these days, anyways?
StraceNT — Windows
Despite the 'NT' in its name, this also works on other versions. Highly recommended.
ktrace, kdump — MacOS X
(thanks aufflick! — I immediately added that to my mental
collection of syscall tracers, without which my daytime job would be much harder...)
BTW, several 'classical' Unices do feature an unrelated
strace command... so, just because there is a program called
strace, don't be fooled into believing that this is what you're
looking for... (that's 'STREAMS trace', rather than syscall tracing).
Corrections, additions welcome.