Hi monks im trying extract some tags from .doc files.
Document name : check.doc apple.pst Entry No: 00001 monks.prj Enrty No: 00002
Im trying to extract the .pst and .prj name and the corresponding entry no to an excel sheet..Im currently learning and i dont know how to make an OR condition in perl .i.e i have to extract both .pst and .prj names.. The output should be
Output.xls Name Entry No apple.pst 00001 monks.prj 00002
The snippet im trying is
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->Ran +ge($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: #} } } }
The snippet above is not extracting anything and how to extract both .pst and .prj in one regex..pls rectify ...
In reply to Or condition in Perl by rajkrishna89
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |