use strict; use Storable qw(freeze thaw); use Scalar::Util qw(weaken isweak); # make a circular reference, then weaken it my $a={}; $a->{a}=\$a; weaken($a->{a}); # looks like we're ok isweak($a->{a}) || die; # serilize it my $b=freeze($a); # and unpack it my $c=thaw($b); # check if the weak reference survived the freeze isweak($c->{a}) || die "nope!";