Strangely, when using each %{ $hoh->{ $sid } } I get the error
That's because you are trying to access the non-existent hashref $hoh instead of the existing hash %hoh.
# Hash, this is what you have
my %hoh = ( ... );
# walk each key/value pair contained in the hash reference stored in $
+hoh{$sid}
while ( my ( $key, $value ) = each %{ $hoh{$sid} } ) {
...
}
# Hash reference, what generated the error
my $hoh = { ... };
# walk each key/value pair contained in the hash reference stored in $
+hoh->{$sid}
while ( my ( $key, $value ) = each %{ $hoh->{$sid} } ) {
...
}