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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.