in reply to strange looking code

It looks perfectly understandable to me...

%r ends up having the keys (a,b,c,d,e,f,g,h,i,j) and their respective values (A,B,C,D,E,F,G,H,I,J)

The line @A{keys %r} = keys %r; causes %A to have the keys (a,b,c,d,e,f,g,h,i,j) and the respective values (a,b,c,d,e,f,g,h,i,j).

In the final line, print %A, "\n";, %A is being used in a list context, and thus looks like a list of key-value pairs, like so: (a,a,b,b,c,c,d,d,e,e,f,f,g,g,h,h,i,i,j,j), which gets printed out with no delimiters between each element as aabbccddeeffgghhiijj, which is what you saw.

That help?

Replies are listed 'Best First'.
RE: RE: strange looking code
by Jonathan (Curate) on Oct 20, 2000 at 18:27 UTC
    Thanks for that BlaisePascal and kilinrax, I can see what its doing just don't recognise the construct. - I first thought -w and use strict would moan and was surprised when it didn't

    "We are all prompted by the same motives, all deceived by the same fallacies, all animated by hope, obstructed by danger, entangled by desire, and seduced by pleasure." - Samuel Johnson
      I believe @foo{ LIST } = LIST is a hash slice, just by way of terminology.

      Philosophy can be made out of anything. Or less -- Jerry A. Fodor