in reply to Process file regardless of the platform it was created on

If you know which kind of file it is you are processing you can apply the :crlf IO layer if necessary.

If you don't know, I guess you'll have to resort to s/\s+$// instead of chomp. (If you don't want to remove all trailing whitespaces you have to tweak the regex, of course)

You could write your own IO layer of course which turns any crlf and lf into $/.