Your example doesn't open any files. It also splits on whitespace while the defined spec was to split on colons. It also embeds newlines between some of the joined values; newlines carried through by not chomping each line of the input files.
Calling it "pseudo-code" doesn't fix the mistakes.
Dave
"If I had my life to live over again, I'd be a plumber." -- Albert Einstein