3 ms·
mb:~ doug$ perl -e "if ('ω'=~/\w/) {print \"It IS a word character.\";} else {print \"Maybe my language settings?\n\n\";}" Maybe my language settings?
by ratsbane 16y ago
mb:~ doug$ perl -e "if ('ω'=~/\w/) {print \"It IS a word character.\";} else {print \"Maybe my language settings?\n\n\";}"
Maybe my language settings?
- d0mine 16y ago$ perl -E'say "ω is " . "not "x("ω" !~ /\w/) . "a word"' ω is not a word $ perl -Mutf8 -E'say "ω is " . "not "x("ω" !~ /\w/) . "a word"' Wide character in print at -e line 1. ω is a word
- perlgeek 16y agoYou can get rid of the "wide character" warning with the -CS switch. As you demonstrate correctly, you need to tell Perl about the encoding of your script (and thus the literals in your script). `use utf8;` or at the command line `-Mutf8` does that.