Are you certain you want to do a $get_xml->unlink($rem_name) or die "Couldn't remove $there: $!";, or do you mean $get_xml->unlink($there) or die "Couldn't remove $there: $!";?
Good catch, that was actually a mistake on my part while
trying to shorten the code down from its original form.
Running this example as it was, or with the change in
variable, produce the same error though.