in reply to Transforming "\r\n" to '\012\015'

DB<106> sprintf '%03o%03o', ord("\r"),ord("\n") => "015012"

if you need to convert a whole string, consider

DB<104> map { sprintf '%03o', ord($_) } split //, "a \r\n" => (141, "040", "015", "012")

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

update

improved null padding, that is %03o instead of 0%o in sprintf.

the latter would produce:

DB<109> sprintf '0%o', ord("a") => "0141"