debiandude has asked for the wisdom of the Perl Monks concerning the following question:

Hey I was wondering if perl has a mode similiar to the shell scripts 'set -x' function. I would like to see how a program goes though things and see where it is spending most of its time. Thanks.

Replies are listed 'Best First'.
•Re: Perl set -x emulation
by merlyn (Sage) on Aug 12, 2004 at 17:25 UTC
    From perldoc perlrun:
    If you're just trying to get a print out of each line of Perl + code as it executes, the way that "sh -x" provides for shell scrip +ts, you can't use Perl's -D switch. Instead do this # If you have "env" utility env=PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS pr +ogram # Bourne shell syntax $ PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS prog +ram # csh syntax % (setenv PERLDB_OPTS "NonStop=1 AutoTrace=1 frame=2"; perl + -dS program) See perldebug for details and variations.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

Re: Perl set -x emulation
by gaal (Parson) on Aug 12, 2004 at 17:12 UTC
      Awesome thanks!
Re: Perl set -x emulation
by gaal (Parson) on Aug 12, 2004 at 17:15 UTC
Re: Perl set -x emulation
by vegasjoe (Sexton) on Aug 12, 2004 at 23:49 UTC