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

Greetings Wiseones - I am confused by the differences between these 3 different ways of pulling information from caller:

First -

my ($package, $filename, $line) = caller; print qq[Problem in $filename at line $line\n];
Second -
my @caller = caller(0); print qq[Problem in $caller[1] at line $caller[2]\n];
Third -
my $filename = (caller(0))[1]; my $line = (caller(1))[2]; print qq[Problem in $filename at line $line\n];
My main question revolves around what the parentheses do around caller: (caller(0))[1].

Thanks for the help.

Replies are listed 'Best First'.
Re: What makes (caller(0))[1] do what it does?
by FunkyMonk (Bishop) on Aug 28, 2007 at 15:52 UTC
      Thank you FunkyMonk. That was easy.