sub typeck { my ($what, $type) = @_; if (!UNIVERSAL::isa($type, 'ARRAY')) { croak 'Type not an array reference' } not grep { !$_ } ( map { grep { $_ } ( (index($_, '/') == 1 and rindex($_, '/') == (length($_) - 1) and do { my $rex = substr($_, 1, length($_) - 1); (ref($what) eq '') ? ($what =~ $rex) : ((Denter $what) =~ $rex); }), (UNIVERSAL::isa($_, 'ARRAY') && do { my $type = $_; not grep {!$_} (map { typeck ($_, $type) } ((UNIVERSAL::isa($what, 'ARRAY')) ? @$what : values(%$what))); }), (UNIVERSAL::isa($_, 'HASH') && do { my $type = $_; not grep {!$_} (map { exists ($type->{$_}) } (keys %$what)); }), (UNIVERSAL::isa($_, 'CODE') && $_->($what)), (UNIVERSAL::isa($what, $_))) } (@$type)); }