You should decode the bytes you read into text strings with
decode in the module
Encode, then do all your work (including regex matches), and before you write/print them, you should
encode them in the charset that your terminal expects.
Read perluniintro for more information on that matter.