in reply to Re: How to remove a carriage return (\r\n)
in thread How to remove a carriage return (\r\n)

if ( m/(\r\n|\n\r|\r|\n)$1/ ) {
You mean
if ( m/(\r\n|\n\r|\r|\n)\1/ ) {
Backreferences inside the RE are notated as \1, \2, etc.

Paul