Document name : check.doc apple.pst Entry No: 00001 monks.prj Enrty No: 00002 #### Output.xls Name Entry No apple.pst 00001 monks.prj 00002 #### my @files; @files=glob('*.doc'); print @files; foreach my $file (@files) { my $var; $var = $SDD_Var."\\".$file; print $var ; my $document = Win32::OLE -> GetObject("$var"); print "Extracting Text ...\n"; my @array; my $lineno =0; my $paragraphs = $document->Paragraphs(); my $enumerate = new Win32::OLE::Enum($paragraphs); while(my $paragraph = $enumerate->Next()) { $lineno++; my $text = $paragraph->{Range}->{Text}; $text =~ s/[\n\r\t]//g; $text =~ s/\x0B/\n/g; $text =~ s/\x07//g; chomp $text; my $Data .= $text; $array[$lineno] = $text; } my $i; for ($i = 0; $i <@array; $i++) { if($array[$i] =~ /$ .pst/) { $sdd = $1; { for ($count = $i; $count >= 1; $count++) { if ($array[$count] =~ /^Entry\s no /) { $Fun = $1; # print "$Fun \n"; #$Fun = $1; my $Mycell1 = $Sheet->Range($Sheet->Cells($row, $col),$Sheet->Cells($row, $col+2)); $Mycell1->{Value}=["$sdd","$Fun"]; $row++; # print $out_fh $sdd."\t".$Fun."\t".$File."\n"; goto breakingfunction; } } } breakingfunction: #} } } }