in reply to Can someone Explain 2 lines of code

There is a hash called %count, which is produced when it is first referred to by perl. The first of those lines increments a value in the hash keyed by $_, the current element of @Clec_id in the for loop. The property of uniquifying the array elements comes from the way hash keys work. Incrementing the value counts the number of times a key appears in @Clec_id

In the second line, there is a loop over the unique elements generated by keys %count. In that loop, $_ comes from those keys. Each is printed with a fat arrow and its count on a separate line.

After Compline,
Zaxo

  • Comment on Re: Can someone Explain 2 lines of code