in reply to Re: How best to replicate/copy a hash of hashes
in thread How best to replicate/copy a hash of hashes

Thanks for the answer. I looked at both Storable and Clone, and ruled Storable out because of performance. I got Clone from CPAN, installed, then ran it in the test. Looked okay, but checking the output, I found that it put a '\n' between the key and data in the cloned hash. Maybe there is an undocumented parameter to fix this. Either way, still looking, but thanks for the info.

Thank you

"Well done is better than well said." - Benjamin Franklin

  • Comment on Re^2: How best to replicate/copy a hash of hashes

Replies are listed 'Best First'.
Re^3: How best to replicate/copy a hash of hashes
by BrowserUk (Patriarch) on Oct 04, 2010 at 18:25 UTC
    I found that it put a '\n' between the key and data in the cloned hash

    That can only be an artifact of the way you are inspecting the cloned hash, because Clone::clone() adds nothing:

    use Clone qw[ clone ];; my $n = 0; my %hash = map{ $_, ++$n} 'a' .. 'e';; pp \%hash;; { a => 1, b => 2, c => 3, d => 4, e => 5 } my $copy = clone \%hash;; pp $copy;; { a => 1, b => 2, c => 3, d => 4, e => 5 }

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      I stand corrected.

      I re-ran the test, and the raw output did not have the '\n'. But when I ran a numeric unix 'sort' on the raw file, it added a '\n' after the '\t' that I used to separate key and data. There are a lot of parms for sort, so I'm sure I need to add something

      But Clone didn't do it!

      Thank you

      "Well done is better than well said." - Benjamin Franklin