in reply to
Attempt to free unrefed scalar
I don't know the answer, but googling for "Attempt to free unreferenced scalar: SV" reveals this node (among other sites) which may be of use to you:
Attempt to free unreferenced scalar
Comment on
Re: Attempt to free unrefed scalar
In Section
Seekers of Perl Wisdom