on Mon, 08 Jul 2002 12:30:48 GMT, [EMAIL PROTECTED] (Patricia Hinman) wrote:
> I'm creating code that takes a list of attributes and > puts together each possible attribute with the item. > > This is a matter of not knowing where to increase the > indexes at. And not knowing how to assign the indexes. Why not use nested for-loops: #! perl -w use strict; my @types = qw(basketball baseball beach golfball soccerball); my @sizes = qw(large medium small); my @colors = qw(green red); my @fullnames = generate_fullnames(\@types, \@sizes, \@colors); print "$_\n" for (@fullnames); sub generate_fullnames { my ($typesref, $sizesref, $colorsref) = @_; my @fullnames = (); for my $t (@$typesref) { for my $s (@$sizesref) { for my $c (@$colorsref) { push @fullnames, "a $c, $s $t"; } } } return @fullnames; } -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]