my $line = 'Text with unusual punctuation<91><91><91> I<92>m not going to lie<93> this is odd text<94>'; $line =~ s/<91>/./g; $line =~ s/<92>/'/g; $line =~ s/<93>/,/g; $line =~ s/<94>/!/g; # etc.