in reply to Bug in Devel::DProf?

Well, as pointed out, if you use parse (@_), you should see three lines, 2 from the initial call to parse, and one from the recursive call. If you examine carefully, you'll notice that the first Number: 0 comes from the recursive call, and the last Number: 0 is from the initial call, in the second iteration of the while.

So, what about doing this with &parse you may ask. Well, if you call from sub1, &sub2, then sub1 and sub2 will actually share @_! Look for instance at:

#!/usr/bin/perl use strict; use warnings; sub foo { print "Foo: [@_]\n"; shift; } sub bar { print "Bar: [@_]\n"; &foo; print "Bar: [@_]\n"; } bar 1, 2 __END__ Bar: [1 2] Foo: [1 2] Bar: [2]

Shifting off an element of @_ in foo() is noticeable in bar().

Leaves us the question, why three lines in perl -d:DProf test.pl when the function is called as &parse? For that, I do not know the answer. I can just guess that DProf puts each function in some kind of wrapper, causing the arguments to get duplicated.

Abigail