my (@item, @color); while() { chomp; my($item, $color) = split(/,/); push @item, $item; push @color, $color; } for(my $i=0; $i < @item; $i++) { print "$item[$i] has color $color[$i]\n"; } __DATA__ apple,red orange,orange banana,yellow