# assume that the first call to printlist passes the
argument
# 0 as the value for $index
sub printlist {
        local ($index, @list) = @_;

        if ($index + 1 < @list) {
                &printlist ($index+1, @list);
        }
        # the conditional handles the case of an empty list
        print ("$list[$index]\n") if (@list > 0);
}
