Ciò avviene perchè non dici a DBM::Deep che quella che vuoi costruire è una struttura composta da un hash di hash.

prova ad eseguire da terminale il tuo codice con l'aggiunta seguente:

codice:
use strict;
use warnings;
use diagnostics;
use CGI::Carp "fatalsToBrowser";
use Data::Dumper;

use DBM::Deep;

my $db = new DBM::Deep "data.db";

my $myhash = "Zlatan";

$db->{$myhash}->{'name'} = "Zlatan";
$db->{$myhash}->{'age'} = "22";

print "Content-type: text/html","\n\n";
print "ok!\n";
print Dumper($db);

exit(0);
vedrai che la struttura che hai creato è la seguente:

codice:
$VAR1 = bless( {
                 'Zlatan' => bless( {
                                      'age' => '22'
                                    }, 'DBM::Deep' )
               }, 'DBM::Deep' );
come vedi ha incamerato solo il secondo elemento 'age' sovrascrivendo 'name'.

ora prova ad usare questo codice:

codice:
use strict;
use warnings;
use diagnostics;
use CGI::Carp "fatalsToBrowser";
use Data::Dumper;

use DBM::Deep;

my $db = new DBM::Deep "data.db";

my $myhash = "Zlatan";

$db->{$myhash} = {}; ## nota questo

$db->{$myhash}->{'name'} = "Zlatan";
$db->{$myhash}->{'age'} = "22";

print "Content-type: text/html","\n\n";
print "ok!\n";
print Dumper($db);

exit(0);
vedrai che la struttura sarà quella voluta:

codice:
$VAR1 = bless( {
                 'Zlatan' => bless( {
                                      'age' => '22',
                                      'name' => 'Zlatan'
                                    }, 'DBM::Deep' )
               }, 'DBM::Deep' );
e che tutto funzionerà, grazie al fatto che hai indicato a DBM::Deep di costruire una struttura adatta.