[please don't top post]

On Thu, Mar 6, 2008 at 10:50 AM, yitzle <[EMAIL PROTECTED]> wrote:
> I don't know much about how Perl deals with this stuff, but what
>  you've done is made a copy of the pointer/reference.
>  Both variables are referencing the same memory/hash.
>  What you want to do is copy the hash, not copy the reference to it.
>  I /think/ this ought to work:
>  my %hash = %{$fileSize};
>

The problem here is that it only works if the structure is one level
deep. If any of the values are themselves references, they won't be
dereferenced, and the bug will be very difficult to track down.
Consider something like:

 my $ref = {
     key => 0101010,
     categories => [qw/ 001 002 007 /],
     handle => {fname => 'James', lname => 'Bond'}
     };

Take a look at the Stoable module, instead. the dclone function is
probably more what you're looking for.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.downloadsquad.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to