#!/usr/bin/perl use MIME::Lite; $pattern ='hello'; my $msg = MIME::Lite->new( From => 'rajyalakshmi.bangar@eternoinfotech.com', To => 'bangar.rajyalakshmi@gmail.com', Type => 'multipart/mixed', Subject => "Fetch issues as on $dateFile'", ); $msg->attach( Type => 'TEXT', Data => "Hi,Please find attachement for Fetch issues as on '$dateFile'", ); $msg->attach( Type => 'text', Path => 'results.txt', Filename => 'results.txt', ); #sysopen($FILE,$filepath,o_RDWR) or die "could find the file"; open FILE, ") { if($line=~m/\b$pattern/) { print " match"; $msg->send; } }