New answers tagged

0

Well, I finally found the solution. It's described in an article by brian d foy -- https://www.effectiveperlprogramming.com/2010/10/specify-any-character-by-its-octal-ordinal-value/. I was indeed incorrectly specifying both the hex code and the octal code. After finding Brian's article my program is now corrected to be the following: use strict; use ...


0

From Tom Yan’s comment, it appears that -CSD is actually messing it up somehow.  Leave it out, and usually¹ I get what I want (at least with my locale): WGroleau@MBP ~ % echo "Let’s try again for an em-dash" > /tmp/tmp WGroleau@MBP ~ % cat /tmp/tmp Let’s try again for an em-dash WGroleau@MBP ~ % perl -p -i -e 's:em-dash:—:g;' !$ perl -p -i -e 's:...


0

The command line is not the same thing as standard input and doesn't go through PerlIO – it is a flat string array (@ARGV in Perl) which is handled by -CA rather than -CS. You need -CSDA to cover everything. (Alternatively, call utf8::decode($_) for @ARGV near the beginning of your script.)


Top 50 recent answers are included