Is your log file an ASCII/UTF formatted file?...because it looks suspiciously like a binary file that happens to have some ASCII text in it. If it is a binary file either use the appropriate tool to dump it as text before processing OR proceed with due caution as regex and other text based perl functions may not work the way you want when working on binary data.