I fixed your code below. You were very close. Always
use strict; and
use warnings;.
I also showed 2 popular ways of having Perl dump the structure for you. Data::Dumper is a CORE module and will always be available. Data::Dump will usually be available. Note that pp outputs to stderr and so I had to turn the buffering of stdout off in order for the printout to come out in the expected order.
use strict;
use warnings;
use Data::Dump qw(pp);
use Data::Dumper;
$|=1; #turn off stdio buffering
my %HoH = ( "2023-01-01" => { "00:00" => 1234,
"01:00" => 789,
"02:00" => 456, },
"2023-02-01" => { "00:00" => 4321,
"01:00" => 987,
"02:00" => 654, },);
for my $dia (sort keys %HoH){
print "<br>$dia: \n";
for my $horarios (sort keys %{$HoH {$dia}}){
print "$horarios=>" . $HoH{$dia}{$horarios} . "\n";
}
}
print "VALUE:<br>";
print $HoH{"2023-01-01"}{"00:00"}; #I couldn't see the value
print "\n\n";
pp \%HoH;
print "\n\n";
print Dumper \%HoH;
__END__
Prints:
br>2023-01-01:
00:00=>1234
01:00=>789
02:00=>456
<br>2023-02-01:
00:00=>4321
01:00=>987
02:00=>654
VALUE:<br>1234
{
"2023-01-01" => { "00:00" => 1234, "01:00" => 789, "02:00" => 456 },
"2023-02-01" => { "00:00" => 4321, "01:00" => 987, "02:00" => 654 },
}
$VAR1 = {
'2023-02-01' => {
'01:00' => 987,
'02:00' => 654,
'00:00' => 4321
},
'2023-01-01' => {
'00:00' => 1234,
'02:00' => 456,
'01:00' => 789
}
};