hi how do I make the iterate over a array and then search for the string 1 first through one array2 (between two patterns) and then search for the same string 1 through array3 (between two string patterns) and print the array 1 output and array 2 output one below the other . I tried this but for some reason its iterating over the entire array 2 first for all the array 1 elements and then going through the array 3 for all the array 1 elements.
my @array1 = `cat $ARGV[0]`; my @array2 = `cat $ARGV[1]`; my @array3 = `cat $ARGV[2]`; my $read01 = 0; my $newone = (); my $name = (); my $read01 = 0; foreach my $i (@array1){ my $j = $i; chomp($i); my $pp1 = () ; my $ff1 = (); my $gg1 = (); for(@array2){ $read01++ if $read01; s/CREATE TABLE/CREATE BREAKTABLES/g; my $read01 = 0; if ( "CREATE BREAKTABLES TEMP.$i") { ($pp1,$ff1) = split(/BREAKTABLES/); $ff1 =~ s/\(//g; $ff1 =~ s/\s+//g; $ff1 =~ s/TEMP\.//g; $name = $i if ($i = $ff1); ## print "name $name \n"; } print "$name $ff1 --- $_"; } #### END array2 my $read02 = 0; for(@array3){ chomp($i); $read02++ if $read02; s/CREATE TABLE/CREATE BREAKTABLES/g; if ( "CREATE BREAKTABLES TEMP.$i") { my ($pp1,$gg1) = split(/BREAKTABLES/); $gg1 =~ s/\(//g; $gg1 =~ s/\s+//g; $gg1 =~ s/TEMP\.//g; $newone = $i if ($i = $gg1); } print "MIRROR $newone $gg1 --- $_"; } }
I am a non programmer and I having a hard time imagining. Thank you

In reply to Re^2: between pattern search not working by Anonymous Monk
in thread between pattern search not working by Anonymous Monk

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.