the first line isn't useful, because the second code line will remove all trailing white spaces, including the \r Windows CR character.
While I take your point, they are not entirely equivalent. The difference is that the first line removes all the \r characters wherever they appear in the line. The second does not do that.
use strict;
use warnings;
use Test::More tests => 2;
my $have = "foo\rbar\rbaz\r\n";
my $want = "foobarbaz";
$have =~ s/\s+$//;
isnt $have, $want, 'Not all carriage returns removed';
$have =~ s/\r//g;
is $have, $want, 'All carriage returns removed';
I've spent far too much time over the years fighting poorly-formed, non-compliant, randomly-encoded data originating from Windows to assume anything about the quality of such data. YMMV.