Hi list, given an array reference in a hash, how can I append an item to the end of that array? Or find the length so that I can assign it using $ref-[$n] type notation?
I have tried various comboes... $hash{$key} holds a reference to an array in the sample code presented. *) push(@$hash{$key},$item); # ---> gives an error message, not a valid array for push *) $hash{$key}->[scalar $hash{$key}]=$item; #no good either *) $hash{$key}->[scalar @$hash{$key}]=$item; #no good *) $hash{$key}->[scalar @{[$hash{$key}]}]=$item; #no good either The following notation turned out to work though... my $r=$hash{$key}; my @l=@$r; $hash{$key}->[scalar @l]=$item; ...but I dont like the idea of _having_ to use those extra lines of code there, there should be a way to append an item to a list reference in one single operation. Regards, Torbjørn Lindahl _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs