Switched to Perl regex matching on refs