use re 'debug'; $_ = join '', map chr, 0 .. 31, 128 .. 255; chop($_ .= chr(256)); # same string, but now upgraded to UTF8 1 while m{.}sg;