@matrices = qw(user_group user_realm group_realm realm_template template_subsite realm_subsite); #### sub IsMatrix { shift if UNIVERSAL::isa($_[0], __PACKAGE__); my ($child, $parent) = @_; my $cache = undef if undef; unless ($cache) { my %cache; @cache{@matrices} = (1) x scalar(@matrices); $cache = \%cache; } return $cache->{"${child}_$parent"}; } #### grep /^${child}_$parent$/, @matrices;