Although others have suggested using ord, I would have used a different approach by using Number::Latin.
The code below looks at a character and if its an alphabet (a-z), it will convert it to an integer (regardless of case) and print it. And it will print the string "Something else" if the character is not an alphabet character.
use strict;
use warnings;
use feature 'say';
use Number::Latin;
my $string1 = 'abcdef ghijkl-mnopq,rstuv.wxyz';
my $string2 = uc($string1);
say $string1;
for my $char (split //,$string1) {
if ($char =~ /[a-zA-Z]/) {say latin2int($char);}
else {say "Something else"}
}
say $string2;
for my $char (split //,$string2) {
if ($char =~ /[a-zA-Z]/) {say latin2int($char);}
else {say "Something else"}
}