My use of push changed the nature of your structure %data from a hash of arrays to a hash of arrays of arrays. (refer: perldsc) Please uncomment my "print Dump" statement and run my code again. Refer to that dump as you read my explanation.
The keys of the hash %data are the instances of $curr_identifier. The corresponding values are array refs. Each of these refers to an array of two elements (one for each line associated with the curr_identifier). Each of these elements is itself a reference to an array (in fact, each array is an instance of your originally "@result".)
My for loop iterates through the keys ($curr_identifier) of the hash %data. For each key, it stores the corresponding value (A reference to an array of arrays) as $curr_data. The next four statements, which you explicitly asked about, dereference that reference (Section "Using References" in perlref) to get the two values of height and the two values of markername. I appended a zero or a one to each name to indicate which of the pair of lines it came from.
|