my $ref = ref($_); if( $ref eq 'Regexp' ) { #ah, we are matching a match } elsif( $ref eq 'CODE') { #sombody slipped a sub{} in here, ok } elsif( $ref eq 'ARRAY') { #an @array we have found } elsif( $ref eq 'HASH') { #a %hash, obviously } elsif( $ref eq '') { #must be a $scalar } else { warn "Unknown ref() wth is a $ref ?!"; }