What you need are references. The crucial line is this one
which should instead be$date_class_room{$s_date} = %class_room;
The rest of your code you can keep pretty much the same, although I have to say storing the contents of a hash (%class_room) into an array (@x) and then into another hash (%b) is kind of a weird thing to do, but it will work. The only thing you need to change is the line where you assign to @x:$date_class_room{$s_date} = \%class_room;
What this means is that because up above we stored a reference to a hash as the value in our main hash, we can use the %{} construct to turn that reference back into a real hash - in this case, to produce a list of keys and values. The link above points to a tutorial on this and you can also look in Tutorials.@x = %{$date_class_room{$_}};
As a personal quip, if it were up to me, $scalar = %hash would either do the same thing as $scalar = \%hash or be a compile-time error.
In reply to Re: Assigning Hash to Hash
by Errto
in thread Assigning Hash to Hash
by shilpam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |