... copying every field in the object by hand to the new object.
Maybe (untested):
Of course, this is still essentially "copying by hand" with lotsa potential pitfalls.use Scalar::Util qw(blessed); sub clone { my $self = shift; my $clone = blessed($self)->new or die "clone failed ($self)"; @{$clone}{keys %$self} = (values %$self); return $clone; }
Give a man a fish: <%-(-(-(-<
In reply to Re^3: How can one change the keys of a hash to an alternative set of keys?
by AnomalousMonk
in thread How can one change the keys of a hash to an alternative set of keys?
by tkguifan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |