sub length { return 0 unless @_; # manual pattern matching of the array here my ($head, @tail) = @_; return 1 + length(@tail); }