On Jun 21, Nick Transier said:

>I have written some OO perl and I have a problem that I just realized, when 
>you set an object = to another object, they become irreversibly linked and 
>all operations on one or the other causes changes in both. If I am trying to 
>simply initialize the object and not link them, how do I get around this 
>problem?

You want to make a clone of the object.

  use Storable 'dclone';  # you might need to get this from CPAN
  $new = dclone $orig;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to