08/08/24 12:13:55
こんなのはいかが
my @circles = qw/① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳/;
my @romanU = qw/Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ/;
my @romanL = qw/ⅰ ⅱ ⅲ ⅳ ⅴ ⅵ ⅶ ⅷ ⅸ ⅹ/;
my %hash = ();
%hash = (%hash, map { $circles[$_-1] => "($_)" } 1..20);
%hash = (%hash, map { $romanU[$_-1] => $_, $romanL[$_-1] => $_ } 1..10);
sub to_arabic_number {
my $str = shift;
$str =~ s/([①-⑳Ⅰ-Ⅹⅰ-ⅹ])/$hash{$1}/ge;
$str;
}