From: Jan Gruber <[EMAIL PROTECTED]> > I'm trying to build a linked list, containing hashrefs. > Walking through the %HashRef (-x %HashRef) i can see a lot of > 'REUSED_ADDRESS'es in the list. At the end, all refs point to one > single adress, so every HashRef in my list points to the same hash. > > I have considered trying the OO way, but this would require a major > rewrite of the program. This could be done later on, but for the > moment, i would be happy with another way. > > How do i return a new (read: different) Hashref from a sub on each > call ?
sub one { my $href = {}; $href->{foo} = 'bar'; ... return $href; } or sub two { my %hash; # the "my" is IMPORTANT $hash{foo} = 'bar'; ... return \%hash; } Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]