in reply to comparing sentences

G'day cntrtrst,

"The purpose is to get incoming text streams and compare them to a template ..."

Would this template lend itself to conversion to a regular expression? If so, your comparison might just be "$input =~ /$template_regex/".

[Note: My reply is purely a guess at a solution. As others have already said, better information from you will result in better answers from us. See "How do I post a question effectively?".]

— Ken