But, what's that int doing there in your code? A perl character is a string, not a number. I bet you're thinking of the functionality offered by ord. But ord(chr(127)) is nonsense, that's just 127.
Gives (among other interesting but pointless for this demo):
Scalar value @types[$t] better written as $types[$t] at test.pl line 4 (#2) (W syntax) You've used an array slice (indicated by @) to select a single element of an array. Generally it's better to ask for a scalar value (indicated by $). The difference is that $foo[&bar] always behaves like a scalar, both when assigning to it and when evaluating its argument, while @foo[&bar] behaves like a list when you assign to it, and provides a list context to its subscript, which can do weird things if you're expecting only one subscript.
"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce