in reply to strange looking code

So you say the confusing part is:
@A{keys %r} = keys %r;
as someone pointed out, its a hash slice, but when someone unfamiliar with it sees one, they usually wonder 'why is an @ in front of a hash array?'

Well, sort of the same reason you see '$' in front of an array or a hash when you're referring to one element of it, because in '$hash{name}' you're referring to a scalar element of the hash, and in '@hash{@array}' you're referring to an array of values. This one happens to be '@A{keys %r}', which still the same sort of thing since 'keys' returns an array.

So you're assigning an array of values to an array of elements, although the LHS happens to be an array of hash elements.