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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |