Code update. Didn't take alot of thought #!C:\Perl\bin\perl.exe BEGIN{open(STDERR,">>./err.txt");} use CGI param, header; print header(); @type = ("basketball","baseball","beach","golfball","soccerball"); @size = ("large","medium","small"); @color = ("green","red"); @ballsel = (@type,[@size,[@color]]); &printnames; sub printnames{ $type = 0; $type2 = @type; $size = 0; $size2 = @size; $color = 0; $possible = @type*@size*@color; print "Items possible: $possible<BR>"; for($i;$i<@type*@size*@color;$i++){ $fullname[$i] = $ballsel[$type].",".$ballsel[$type2][$size].",".$ballsel[$type2][$size2][$color]; $color++; if($color == @color){$size++;$color=0; if($size == @size){$type++;$size=0;} }
}#end of for }#end of sub #********************************** foreach $_ (@fullname){print "\n"; print "$_<BR>"} #********************************** --- Patricia Hinman <[EMAIL PROTECTED]> 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. > > #!C:\Perl\bin\perl.exe > BEGIN{open(STDERR,">>./err.txt");} > use CGI param, header; > print header(); > @type = > ("basketball","baseball","beach","golfball","soccerball"); > @size = ("large","medium","small"); > @color = ("green","red"); > @ballsel = (@type,[@size,[@color]]); > &printnames; > sub printnames{ > $type = 0; > $type2 = @type; > # these with 2 are anchor indexes for the arrays of > #arrays > $size = 0; > $size2 = @size; > $color = 0; > $typeindex = @type*@size; > $sizeindex = @size; > for($i;$i<@type*@size*@color;$i++){ > ############################# > #trouble area > > if($i == $typeindex){$typeindex += > $typeindex;$type++;if($type == @type){$type = 0} > } > if($i == $sizeindex){$sizeindex += > @size;$size++;if($size == @size){$size = 0}} > > $color++;if($color == @color){$color = 0} > ############################# > $fullname[$i] = > $ballsel[$type].",".$ballsel[$type2][$size].",".$ballsel[$type2][$size2][$color]; > }#end of for > > }#end of sub > > #********************************** > foreach $_ (@fullname){print "\n"; > print "$_<BR>"} > #********************************** > > > __________________________________________________ > Do You Yahoo!? > Sign up for SBC Yahoo! Dial - First Month Free > http://sbc.yahoo.com > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]