use strict; use warnings; use Math::GMP; my $orig = Math::GMP->new(2); my $copy = $orig; # At this point $copy and $orig refer to # one and the same Math::GMP object. $copy += 5; # At this point, $copy refers to a newly # created Math::GMP object that holds a # value of 7; $orig still refers to the # original object, holding a value of 2. print "$orig\n"; # prints 2 print "$copy\n"; # prints 7 #### use overload ... , '=' => \&overload_copy, ... ;