in reply to Trying to understand behavior of split and perl in general with UTF-8
For one, you'd need to decode the UTF-8 encoded @ARGV input into Perl's internal unicode representation. Similarly, encode any unicode output back to UTF-8 for the terminal.
... use Encode; binmode STDOUT, ":utf8"; # for output for my $old_name (map decode('UTF-8', $_), @ARGV) { ...
Instead of explicitly decoding @ARGV input, you could also use -CA (see perlrun). The problem with this option is, though, that you can't put it in the shebang line (error: "Too late for "-CA" option at..."), but only on the command line like perl -CA yourscript.pl ...
Update: actually, #!/usr/bin/perl -CA finally does seem to work, too, as of Perl 5.10.1.
|
|---|