Encode-Simple
view release on metacpan or search on metacpan
lib/Decode/ARGV.pm view on Meta::CPAN
use Decode::ARGV; # decodes from UTF-8
use Decode::ARGV 'cp1252';
$ perl -MDecode::ARGV -E'say "Argument contains only word characters" unless $ARGV[0] =~ m/\W/' 'Ñлово'
=head1 DESCRIPTION
This module provides simple in-place decoding of command-line arguments in the global array
L<@ARGV|perlvar/"@ARGV">. As with most input and output, command-line arguments are provided to the
script in bytes, and must be decoded to characters before performing string operations like
C<length> or regex matches.
The C<-CA> switch for Perl performs a similar function, but this has some deficiencies. It assumes
via the C<:utf8> internal layer that the arguments are valid UTF-8 bytes, ignoring invalid Unicode,
and even resulting in malformed strings if the bytes do not happen to be well-formed UTF-8. This
switch is also difficult to use in a script and cannot decode the arguments from other encodings.
=head1 PARAMETERS
use Decode::ARGV;
( run in 0.270 second using v1.01-cache-2.11-cpan-0d8aa00de5b )