Hi Monks, I'm having issues with the following code. "job types..." gets printed, as well as the $temp_jobvar,$quick_jobtype..., but it never reaches $sortby, or "starting build lists..." and I have no idea why. It runs through the loop and prints out all the temp_jobvars and quick_jobtype, but when they match it just keeps going. If you look at the print statements below you'll see my notes...
@jobvar_list=(); @jobname_list=(); @jobnice_list=(); $n = 0; @jobvar_list[$n] = "senior"; @jobname_list[$n] = " Senior"; $n++; @jobvar_list[$n] = "exec"; @jobname_list[$n] = " Executive"; $n++; $quick_build="listing"; $quick_jobtype="exec"; print "job types...<br>\n"; #(THIS GETS PRINTED) for ($st=0; $st<=@jobvar_list-1; $st++) { $temp_jobvar = @jobvar_list[$st]; print "$temp_jobvar, $quick_jobtype...<br>\n"; #( THESE GET PRINTE +D AS THE LOOP GOES THROUGH) if (($quick_jobtype && ($quick_jobtype eq $temp_jobvar)) || (!$qui +ck_jobtype)) { #if ($quick_jobtype eq $temp_jobvar) { #ALTERNATE IF STATEMENT THAT + ALSO DOESN'T WORK $jobvar = $temp_jobvar; $jobname = @jobname_list[$st]; $groupfile = $jobvar; $grouptitle = $jobname; $sortby = " WHERE jobtype like '%$jobvar%' and active='yes' AND jo +bstatus!='suspend' ORDER BY dateadded DESC, jobtitle ASC"; print "$sortby"; #(THIS DOES NOT GET PRINTED) print "starting build lists<br>\n"; #(THIS DOES NOT GET PRINTED) $building_cat = "yes"; &Build_Lists_Both; } # end if ($cat1 eq $cat_db_var) } # end for ($st=1; $st<=$jobvar_list; $st++)
I can't figure out why it doesn't go through. I've even changed the IF statement and it doesn't work either. I'm stumped.

In reply to Help with a loop by htmanning

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.