i am trying to write a code to find two pattern from one file sequentially. while the code is running but only i am getting one pattern and not the second pattern. when i have added a print statement in second loop it shows n time "into the second loop.." print for the same no of times as n as no of lines in the file but not the second pattern

opendir( my $synthdir,$target_dirsynth1) or die "Couldn't enter config + directory: $!\n"; print("\nSYNTHESIS INPUT FILES IN CURRENT DIRECTORY \n"); my $synthfilelist = glob "*.qsf"; print ("\n$synthfilelist \n"); my $originalquartus ; my $latestquartus ; my $readlineqo; my $readlineql ; open (my $OFILE,$synthfilelist) || die "couldnt open file: $!"; while ($readlineqo = <$OFILE>) { chomp $readlineqo; if ($readlineqo =~ /ORIGINAL_QUARTUS_VERSION/) { my @originalqarray = (split / +/ , $readlineqo); $originalquartus = $originalqarray[3]; print "\nthe original quartus $originalquartus\n"; } next if $readlineqo =~ /^ $/; } close($OFILE); open (my $LFILE,$synthfilelist) || die "couldnt open file: $!"; while ($readlineql = <$LFILE>) { chomp $readlineql; print "into the second loop $readlineql\n"; if ($readlineql =~ /LAST_QUARTUS_VERSION/) { my @latestqarray = (split / +/ , $readlineql); $latestquartus = $latestqarray[3]; print "\nthe latest quartus $latestquartus\n"; } next if $readlineql =~ /^ $/; } close($LFILE);


In reply to searching two pattern sequentially from one file by mrityunjaynath

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.