On Jul 15, 2005, at 14:50, Octavian Rasnita wrote:
I use to put this hash in a file and get the content using
my $hashref = do $file;
And I want to be able to get the dupplicate keys in order to delete
them
manually, without needing to search for each manually and compare
it with
every other key from the hash, because if there are only a few keys
there is
no problem, but if there are very many... it is.
OK, you seem to assume that the hash actually stores all the pairs
behind the scenes and delivers the last one. If that's the case, this
is not how hashes work, the previous pair slot is overwritten, so to
speak, so there is no wasted space, nothing to clean.
A way to see this we your own eyes is to run this one liner
% perl -e 'push @x, 0 while 1'
and monitor memory usage. It grows. Kill it and try this one now
% perl -e '$h{0} = 0 while 1'
you'll see it's constant.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>