Fixed some segfaults in rlm_perl

This should fix the changes of #707