if ( is_not_a_reference($x) ) { print $x; } elsif ( is_a_hash_ref($x) ) { process_hash( %$x ); } else { . . . }