my @stack; my $depth = 0; while (my @frame = caller $depth++) { push @stack, \@frame[0,1,2]; }