in reply to
Re^2: Sort then conditionally sort
in thread Sort then conditionally sort
The construct is called a "here-document", and you can find them documented in perlop. It's basically a way to include some large chunk of text as a value in your program.
In this case, I used it to hold your example data. After setting $op_io to that value, I use split to cut it into individual lines, and I loop over those lines to pull the individual values out. When I'm done, I have your inputs and desired output.
I did it that way so I wouldn't have to reformat what you posted. I just pasted it in and wrote some code to pull out what I wanted.