open "NPC", "L2NPC.exe"; open "NPCOUT", ">NPC.txt"; binmode NPC; $cnt=0; $str = ''; while () { $str .= $_; } @strings = split m{\x00\x00}, $str; for $string (@strings) { $string =~ s{[\x00-\x1f\x7f-\xff]}{}g; if ($string) { print NPCOUT "$string\n"; } }