Hi Jeroen, >while (@values = $lcsr->fetchrow) {
This is probably the root of your problem every time you go through this loop, you are repopulating your array, put a my before @values. > $key = shift @values; > $key.= shift @values; > > push @$ref_to_a, [EMAIL PROTECTED]; I don't recognise this format, I'd have done this line as. push @$ref_to_a, [EMAIL PROTECTED]; > if ($old_key ne $key) { > $hash{$key} = $ref_to_a; > my $ref_to_a = undef; > } > $old_key = $key; >} Having made these comments, I haven't really understood your logic or the need for your, old_key values. I'd have done something like the following. while (my @row_data = $lcsr->fetchrow ) { $key = shift @row_data; $key.= shift @row_data; # create top level array if this is the first time we've seen this key if (! defined $data{$key}) {$data{$key} = []} my $array_ref = $data{$key}; push(@$array_ref, [EMAIL PROTECTED]); } Hope this helps Rob Anderson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]