in reply to Perl appending \ or / based on windows or linux
Running your code against your shown input does not produce the output you are showing. Please fix the input, code, and/or output.