Use perl rather than gawk for regex processing