in reply to Reading text file with <CR> line endings

Hello Marshall,

This should do the work for you:

#!/usr/bin/perl use strict; use warnings; use feature 'say'; sub myChmop { my ($str) = @_; chomp $str; return $str; } sub myCrRemove { my ($str) = @_; $str =~ s/\r|\n//g; return $str; } my $str = "abcd\r\n"; my $chompReturn = myChmop($str); say "[$chompReturn]"; my $crRemoveReturn = myCrRemove($str); say "[$crRemoveReturn]"; __END__ $ perl test.pl ]abcd [abcd]

Also read this "similar question" Carrige Return and Line Feed in Perl..

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!