You'll need a deep copy. See
Data::COW.
Update: Or, as
holli suggests below,
Scalar::Util::Clone. The former will do actual copies only of things you change; the latter will copy everything, but fast. So if it's a big structure that you're only modifying a little of, use Data::COW; if you're going to modify a substantial portion of it, use Scalar::Util::Clone.
Caution: Contents may have been coded under pressure.