Your question is a little ambiguous... but maybe you're looking for a non-interactive tracing facility, as provided by the Perl debugger. E.g.

$ cat 794362.pl #!/usr/bin/perl use strict; use warnings; print "Hello world!\n"; $ PERLDB_OPTS="AutoTrace NonStop frame=2" perl -d 794362.pl entering CODE(0x65f740) 3: use strict; 3: use strict; 3: use strict; entering strict::import 28: shift; 29: $^H |= @_ ? bits(@_) : $default_bits; exited strict::import exited CODE(0x65f740) entering CODE(0x65f780) 4: use warnings; 4: use warnings; 4: use warnings; entering warnings::import 336: shift; 338: my $catmask ; 339: my $fatal = 0 ; 340: my $no_fatal = 0 ; 342: my $mask = ${^WARNING_BITS} ; 344: if (vec($mask, $Offsets{'all'}, 1)) { 349: push @_, 'all' unless @_; 351: foreach my $word ( @_ ) { 352: if ($word eq 'FATAL') { 361: $mask |= $catmask ; 362: $mask |= $DeadBits{$word} if $fatal ; 363: $mask &= ~($DeadBits{$word}|$All) if $no_fatal ; 369: ${^WARNING_BITS} = $mask ; exited warnings::import exited CODE(0x65f780) Package 794362.pl. 6: print "Hello world!\n"; Hello world!

(See perldebug for what other options you might want to set via the env variable PERLDB_OPTS)

P.S.: Don't ask (me) why "3: use strict;" / "4: use warnings;" are being printed three times. I don't know... — but maybe someone else does :)


In reply to Re: Executing line number by almut
in thread Executing line number by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.