Parsing from right to left:
- Assuming KEY_FH is a filehandle which has been opened for reading, grep places <KEY_FH> into list context, so it returns a list of the lines in the input file.
- grep applies the regex !/^$/ to each element, filtering out blank lines. So, the output of the call to grep is a list of the non-blank lines in the input file.
- map takes these lines as input, and applies the split function to each.
- This splits on the pipe character (“|”), optionally surrounded by whitespace.
- The LIMIT of 2 ensures that split will return at most 2 fields. So if the line contains more than one |, only the first will be used to split the line into fields. Assuming the line contains at least one |, split will return a list of two fields.
- These two fields are assigned to the hash %key_hash, where they form a key-value pair.
- Finally, chop is applied to the whole hash, which removes the final character from the value half of each key-value pair. This will presumably be the newline character read in at the end of each line. (But chomp would be a better choice here.)
Hope that helps,
Athanasius <°(((>< contra mundum