my @circles = qw/@ A B C D E F G H I J K L M N O P Q R S/; my @romanU = qw/T U V W X Y Z [ \ ]/; my @romanL = qw/@ A B C D E F G H I/; 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/([@-ST-]@-I])/$hash{$1}/ge; $str; }