It is magic - bad magic, but magic none the less. Without showing you my very poorly written OO code. Basically, I am creating a complex hash (HoHo...). There is really only one key to the hash at any one time - which points further down the complex structure. So $hashref is a scalar that is a reference that points to the actual hash. The %{$hashref} is dereferencing the reference it to make it look like a real hash. The keys extracts the one and only key that is there. Putting the parens around the my ($key) part changes the context from scalar (which would have returned the number of keys i.e. 1) to a list context (which returns the one and only key).