in reply to regex and sysread

Just match against the string that contains the file contents, as you would do with any other string.

When you want to do things in perl, try the simplest thing that could possibly work - it often does.