use strict; use warnings; my $fname = "C:\\EITV10CM\\base\\repair\\Companion_Repair\\File2SelfExt\\F2SEXT.COM"; while () { chomp; my $found; next if $_ !~ /^\Q$fname\E/i; chomp($_); /\s\.{3}\s(.*)/; #Trying to extract everthing after ... $found = $1; if ($found eq "is OK.") { my $virusname = "OK"; print "The virus detection name is $virusname\n"; } if ($found =~ /^Found: (.*?) NOT a virus[.]/) { my $virusname = $1; print "The virus detection name is $virusname\n"; } elsif ($found =~ /^Found the (.*?) (virus|trojan) !!!/) { my $virusname = $1; print "The virus detection names is $virusname\n"; #exit(); } elsif ($found =~ /^Found potentially unwanted program (.*?)[.]/) { my $virusname = $1; print "PuPs $virusname \n"; } elsif ($found =~ /Found (virus or variant|application) (.*?)( !!!|[.])/) { my $virusname = $2; print "virus or variant $virusname \n \n"; } } __DATA__ C:\EITV10CM\base\repair\Companion_Repair\File2File\F2F.COM ... is OK. C:\EITV10CM\base\repair\Companion_Repair\File2SelfExt\F2SEXT.CMP ... is OK. C:\EITV10CM\base\repair\Companion_Repair\File2SelfExt\F2SEXT.COM ... Found the CMPAN/File2SelfExt virus !!! The virus has been removed from the file. Checking for another virus in the file ... C:\EITV10CM\base\repair\Companion_Repair\File2SelfExt\F2SEXT.COM ... is OK. C:\EITV10CM\base\repair\Companion_Repair\File2SelfFile\F2SFILE.COM ... Found the CMPAN/FIle2SelfFile virus !!! The virus has been removed from the file. Checking for another virus in the file ... C:\EITV10CM\base\repair\Companion_Repair\File2SelfFile\F2SFILE.COM ... is OK. #### The virus detection names is CMPAN/File2SelfExt The virus detection name is OK