sub li { shift; @_ ? ($#_ + 1, &li) : (); } print li qw(a b c d e f g); # prints 654321