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

Hello
my ($a, $b) = (2,3); sub test{ ($package, $filename, $line, $subr, $has_args, $wantarray ) = caller($ +a); print $package, $filename, $line, $subr, $has_args, $wantarray ; }
I dont get the caller function fill the vars and when i print, nothing in output, ideas?

Replies are listed 'Best First'.
Re: caller function in windows?
by moritz (Cardinal) on Sep 24, 2009 at 11:52 UTC
    If you just call test() you don't have two call frames, so caller(2) is rather meaningless.

    (Update: Actually you do have two call frames if you count the current, but since caller() starts counting at 0, you'd actually need 3 call frames)

    Perl 6 - links to (nearly) everything that is Perl 6.
      And the OP doesn't actually call test().
Re: caller function in windows?
by ccn (Vicar) on Sep 24, 2009 at 11:56 UTC
    see perldoc -f caller about EXPR argument