print $sock "$data\r\n"; my @output = <$sock>; $output = join('', @output); if ($output =~ /$string_to_compare/gi) { &true; } else { &false; } sub true { open(tmpl, "email.txt") || print $!;