Giving up on porting from PHP to Perl