In article <[EMAIL PROTECTED]>, Sudarshan Raghavan wrote: [...] > Reason: 'shallow copying' vs 'deep copying' > Read through this link > http://www.stonehenge.com/merlyn/UnixReview/col30.html
I looked at this article and tried the code but I get different/wrong results (or am doing something wrong)... Using Data::Dumper... All three examples (the bad, the good, and the third way) yield: $VAR1 = { 'games' => [], 'bin' => $VAR1->{'games'}, 'nobody' => $VAR1->{'games'}, 'lp' => $VAR1->{'games'}, 'postfix' => $VAR1->{'games'}, 'named' => $VAR1->{'games'}, 'ftp' => $VAR1->{'games'}, 'at' => $VAR1->{'games'}, 'root' => $VAR1->{'games'}, 'mail' => $VAR1->{'games'}, 'pfeiffer' => $VAR1->{'games'}, 'daemon' => $VAR1->{'games'}, 'ntp' => $VAR1->{'games'}, 'uucp' => $VAR1->{'games'}, 'wwwrun' => $VAR1->{'games'}, 'man' => $VAR1->{'games'}, 'news' => $VAR1->{'games'}, 'sshd' => $VAR1->{'games'} }; Here is the 3rd code example: while (my @x = getpwent()) { $info{$x[0]} = [EMAIL PROTECTED]; } for (sort keys %info) { print "$_ => $info{$_} => @{$info{$_}}\n" } As he writes, the array x gets reinitialized each time, then the reference taken to it falls out of scope leaving behind an anonymous variable. But, something is broken I think... (bzw. I broke it) -K -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]