miyagawa / cpanminus

cpanminus - get, unpack, build and install modules from CPAN
http://cpanmin.us
750 stars 213 forks source link

warning from cpanm: Useless use of /d modifier in transliteration operator #592

Closed atoomic closed 5 years ago

atoomic commented 5 years ago

cpanm raises a warning

> perl -cw cpanm
Useless use of /d modifier in transliteration operator at cpanm line 462.
cpanm syntax OK

Since 5.12 using /d in a tr raises a warning Useless use of /d modifier in transliteration operator at -e line 1.

We should either consider

This can be checked by simplified using the following one-liner

# warning since 5.12
5.28> perl -w -e 'my $x = qq[a\nb\nc\n]; $x =~ tr/\n/ /d; print qq{$] :$x:\n}'
Useless use of /d modifier in transliteration operator at -e line 1.
5.028000 :a b c :
...
> perl -w -e 'my $x = qq[a\nb\nc\n]; $x =~ tr/\n/ /d; print qq{$] :$x:\n}'
Useless use of /d modifier in transliteration operator at -e line 1.
5.012005 :a b c :

this is not a problem with versions before 5.12

# with /w
> perl -w -e 'my $x = qq[a\nb\nc\n]; $x =~ tr/\n/ /d; print qq{$] :$x:\n}'
5.010001 :a b c :

# with /w
> perl -w -e 'my $x = qq[a\nb\nc\n]; $x =~ tr/\n/ /d; print qq{$] :$x:\n}'
5.008009 :a b c :

# without /w
> perl -w -e 'my $x = qq[a\nb\nc\n]; $x =~ tr/\n/ /; print qq{$] :$x:\n}'
5.008009 :a b c :

from https://perldoc.perl.org/perlop.html#Quote-Like-Operators

 d   Use Unicode or native charset, as in 5.12 and earlier.