in reply to regex to add network line-endings if required.

Something like this?

#! perl -slw use strict; sub fixLE { my $string = shift; $string =~ s[(?:\n?\r?\n?)$][\015\012]; return $string; } print join('|', unpack 'C*', substr $_ , -8 ), $/, join('|', unpack 'C*', substr fixLE( $_ ), -8 ), $/ for 'No line ending needs one', "unix style needs fixing\x0a", "mac style needs fixing\x0d", "windows style needs fixing\x0d\x0a", "network style: leave alone\015\012"; __END__ P:\test>junk 101|101|100|115|32|111|110|101 100|115|32|111|110|101|13|10 32|102|105|120|105|110|103|10 102|105|120|105|110|103|13|10 32|102|105|120|105|110|103|13 102|105|120|105|110|103|13|10 102|105|120|105|110|103|13|10 102|105|120|105|110|103|13|10 32|97|108|111|110|101|13|10 32|97|108|111|110|101|13|10

Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.