use utf8; # Source code is encoded using UTF-8. use open ':std', ':locale'; # Decode inputs and encode inputs. use strict; use warnings; use feature qw( say ); my @chars; for my $char (qw( Ð Ñ Ò Ó )) { my $cp = ord($char); # Or unpack 'C' my $utf8 = $char; utf8::encode($utf8); my @utf8 = unpack('C*', $utf8); push @chars, [ $char, $cp, $utf8, @utf8 ]; }