Based on my current understanding of hashes in Perl, I would expect this code to print \"hello world.\" It instead prints nothing.
%a=();
%b=();
$b{str} = \
Perl likes to flatten your data structures. That's often a good thing...for example, (@options, "another option", "yet another")
ends up as one list.
If you really mean to have one structure inside another, the inner structure needs to be a reference. Like so:
%a{1} = { %b };
The braces denote a hash, which you're filling with values from %b, and getting back as a reference rather than a straight hash.
You could also say
$a{1} = \%b;
but that makes changes to %b change $a{1} as well.