foreach my $key (sort keys %$hash_ref) { print substr($key . '.' x 30,0,30) . ' => '; if ($key eq 'bic_candidates') { if(defined($hash_ref->{$key})) { my $typ=ref($hash_ref->{$key}); print "Element hat den typ: $typ\n"; print "(Untermenge wie folgt:)\n"; if($typ eq "ARRAY") { print " $_\n" for( @{ $hash_ref->{$key} } ); } elsif($typ eq "HASH") { print " $_ -> ".$hash_ref->{$key}->{$_}."\n" for(sort keys %{$hash_ref->{$key}}); } else { print Dumper($hash_ref->{$key}); } } else { print "NOT DEFINED"; } } else { print (defined $hash_ref -> {$key} ? (length $hash_ref -> {$key} > 65 ? substr($hash_ref -> {$key},0,60) . '...' : $hash_ref -> {$key}) : 'NOT DEFINED'); } print "\n"; }