perl: Factor out common features of Vectors and Lists into a superclass.