In your second example they both are RIGHT. When calling parse(@_) recursively the new instance of parse creates its own @_. When you shift @_ in the recursive call you are NOT shifting the @_ of the parent caller. Try this:
#!/usr/bin/perl
use strict;
my $call = 0;
parse(1,0);
sub parse {
my $curcall=++$call;
print "My parameters: @_\n";
while (defined(my $number = shift)) {
print "Number: $number from call $curcall\n";
parse(@_) if $number;
}
}
OUTPUT:
My parameters: 1 0
Number: 1 from call 1
My parameters: 0
Number: 0 from call 2
Number: 0 from call 1
Notice how the second printing of '0' is from call 1 and not call 2?