Loading ...
Sorry, an error occurred while loading the content.
 

perl question

Expand Messages
  • Luinrandir Hernsen
    does anyone know how I can write this better? all vars = numbers if ($row = $CrntRow-5 and $col = $CrntCol-5) {
    Message 1 of 7 , Jul 19, 2004
      does anyone know how I can write this better?

      all vars = numbers


      if ($row <= $CrntRow+5 and $row >= $CrntRow-5 and $col <= $CrntCol+5 and $col >= $CrntCol-5)
      {
      }

      or do i need to separted the "and" better from the two "or"s



      Luinrandir

      [Non-text portions of this message have been removed]
    • Charles K. Clarkson
      ... Read the post below and ask your question again under a better topic. Thanks, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328
      Message 2 of 7 , Jul 20, 2004
        Luinrandir Hernsen <Luinrandir@...]> wrote:

        : Subject: [PBML] perl question

        Read the post below and ask your question again
        under a better topic.

        Thanks,

        Charles K. Clarkson
        --
        Mobile Homes Specialist
        254 968-8328


        : -----Original Message-----
        : From: Jenda Krynicky [mailto:Jenda@...]
        : Sent: Sunday, July 11, 2004 12:02 PM
        : To: beginners@...; perl-beginner@yahoogroups.com
        : Subject: [PBML] Could people please use sensible subjects?
        :
        :
        : Here are a few subjects I've seen in the list lately:
        :
        : From beginners@...
        : "Could anyone please answer a simple PERL question." ?
        : "Cool construct" ?
        : "A possibly stupid 'Perl' question?" ?
        : "Dates are killing me.." ?
        : "Need suggestions" ?
        : "perl help" ?
        : "Perl script" ?
        : "pls help" ?
        : "puzzled" ?
        : "questions and understanding" ?
        : "script" ?
        : "VARIABLES" ?
        :
        : and from perl-beginner@yahoogroups.com
        : "here's my code..." ?
        : "hi guys" ?
        : "Could anyone please answer a simple PERL question." ?
        :
        : Guys and gals you can do better than this!
        :
        : Would everyone please try to use sensible, meaningfull, informative
        : subjects? And could the responders try to refrain from answering
        : posts without sensible subjects?
        :
        : If you wanna teach your kid to ask for something politely, you can't
        : go and fetch whatever they want as soon as they say "Mama give me
        : that". If you want them to say "please" you have to wait till they do
        : say it before you give them what they asked for.
        :
        : Jenda
        :
      • Luinrandir Hernsen
        OK.. ignore that I , using this for a CGI I am trying to do a for loop so that %5 of $MaxNum is incremented. here is the NON cgi code for those who are going
        Message 3 of 7 , Nov 1, 2004
          OK.. ignore that I', using this for a CGI

          I am trying to do a "for" loop so that %5 of $MaxNum is incremented.

          here is the NON cgi code for those who are going to freak at the "off
          topic" question, even thought it not really....
          Is there a better way? how would I do this with foreach?


          for $v0 ($v0=0;$v0<$MaxNum;$v0+($MaxNum/20);)
          {
          if ($v0 lt $InCastle && $v0<$v0+($MaxNum/20) )
          {
          }
          else
          {
          }
          }

          and for those who can deal with it... the CGI code

          print qq|<td align=right><SELECT NAME="$ItemName">|;
          for $v0 ($v0=0;$v0>=$MaxNum;$v0+($MaxNum/20);)
          {
          if ($v0 lt $InCastle && $v0+($MaxNum/20) )
          {
          print qq|<OPTION SELECTED>$InCastle|;
          }
          else
          {
          print qq|<OPTION>$v0|;
          }
          }
          print qq|</SELECT></td>|;

          To those few who are gonna freak or be rude ....
          yeah... i'm clueless... please keep any acidic comments to yourself.

          Lou
        • Paul Archer
          ... (I don t have time to go over this in detail...) ...but one obvious thing is lt is for string comparisons. You want
          Message 4 of 7 , Nov 1, 2004
            3:22pm, Luinrandir Hernsen wrote:

            >
            >
            > OK.. ignore that I', using this for a CGI
            >
            > I am trying to do a "for" loop so that %5 of $MaxNum is incremented.
            >
            > here is the NON cgi code for those who are going to freak at the "off
            > topic" question, even thought it not really....
            > Is there a better way? how would I do this with foreach?
            >
            >
            > for $v0 ($v0=0;$v0<$MaxNum;$v0+($MaxNum/20);)
            > {
            > if ($v0 lt $InCastle && $v0<$v0+($MaxNum/20) )
            (I don't have time to go over this in detail...)
            ...but one obvious thing is 'lt' is for string comparisons. You want '<='

            Paul


            > {
            > }
            > else
            > {
            > }
            > }
            >
            > and for those who can deal with it... the CGI code
            >
            > print qq|<td align=right><SELECT NAME="$ItemName">|;
            > for $v0 ($v0=0;$v0>=$MaxNum;$v0+($MaxNum/20);)
            > {
            > if ($v0 lt $InCastle && $v0+($MaxNum/20) )
            > {
            > print qq|<OPTION SELECTED>$InCastle|;
            > }
            > else
            > {
            > print qq|<OPTION>$v0|;
            > }
            > }
            > print qq|</SELECT></td>|;
            >
            > To those few who are gonna freak or be rude ....
            > yeah... i'm clueless... please keep any acidic comments to yourself.
            >
            > Lou
            >
            >
            >
            >
            >
            >
            > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >

            ---------------------------------------------
            There are two major products that come out of
            Berkeley: LSD and UNIX. We don't believe this
            to be a coincidence. - Jeremy S. Anderson
            ---------------------------------------------
          • Jeff 'japhy' Pinyan
            ... You re not *changing* $v0 at all. for (...; ...; $v0 += $MaxNum/20) { ... Uh, use
            Message 5 of 7 , Nov 1, 2004
              On Nov 1, Luinrandir Hernsen said:

              > for $v0 ($v0=0;$v0<$MaxNum;$v0+($MaxNum/20);)

              You're not *changing* $v0 at all.

              for (...; ...; $v0 += $MaxNum/20) {

              > if ($v0 lt $InCastle && $v0<$v0+($MaxNum/20) )

              Uh, use < for numbers ALWAYS.

              --
              Jeff "japhy" Pinyan % How can we ever be the sold short or
              RPI Acacia Brother #734 % the cheated, we who for every service
              http://japhy.perlmonk.org/ % have long ago been overpaid?
              http://www.perlmonks.org/ % -- Meister Eckhart
            • Charles K. Clarkson
              ... That doesn t compile, You probably wanted to submit this. ... print qq| n|; for (my $v = 0; $v
              Message 6 of 7 , Nov 1, 2004
                Luinrandir Hernsen <Luinrandir@...> wrote:

                : I am trying to do a "for" loop so that %5 of $MaxNum is
                : incremented.
                :
                : print qq|<td align=right><SELECT NAME="$ItemName">|;
                : for $v0 ($v0=0;$v0>=$MaxNum;$v0+($MaxNum/20);)
                : { if ($v0 lt $InCastle && $v0+($MaxNum/20) )
                : { print qq|<OPTION SELECTED>$InCastle|;
                : } else
                : {
                : print qq|<OPTION>$v0|;
                : }
                : }
                : print qq|</SELECT></td>|;


                That doesn't compile, You probably wanted to submit this.

                -----------
                print qq|<td align="right"><SELECT NAME="$ItemName">\n|;
                for (my $v = 0; $v <= $MaxNum; $v += $MaxNum / 20 ) {

                if ($v < $InCastle && $v + $MaxNum / 20 ) {
                print qq|<OPTION SELECTED>$InCastle\n|;

                } else {
                print qq|<OPTION>$v\n|;
                }
                }
                print qq|</SELECT></td>|;
                -----------

                if ($v < $InCastle && $v + $MaxNum / 20 ) {

                The second condition will always test true except when
                $MaxNum equals 0, but in that case this statement wouldn't
                run so it is assumed to be unneeded.

                if ( $v < $InCastle ) {


                This solution prints more than one selected item which
                shouldn't be what you want without a MULTIPLE attribute in
                the SELECT tag. If you tell us precisely what you're trying
                to do, we could probably help you find better solutions.


                HTH,

                Charles K. Clarkson
                --
                Mobile Homes Specialist
                254 968-8328


                : here is the NON cgi code for those who are going to freak
                : at the "off topic" question, even thought it not really....
                : Is there a better way? how would I do this with foreach?

                : and for those who can deal with it... the CGI code

                : To those few who are gonna freak or be rude ....
                : yeah... i'm clueless... please keep any acidic comments to
                : yourself.

                How old are you? 10?
              • Luinrandir Hernsen
                right, thanks... I keep forgeting that... Thanks! I have change the code, after doing som eresearch, in a while command... and got it working! HooBah! Lou ...
                Message 7 of 7 , Nov 1, 2004
                  right, thanks... I keep forgeting that...
                  Thanks!

                  I have change the code, after doing som eresearch, in a while command...
                  and got it working! HooBah!

                  Lou
                  ----- Original Message -----
                  From: Paul Archer
                  To: perl-beginner@yahoogroups.com
                  Sent: Monday, November 01, 2004 10:29 AM
                  Subject: Re: [PBML] perl question


                  3:22pm, Luinrandir Hernsen wrote:

                  >
                  >
                  > OK.. ignore that I', using this for a CGI
                  >
                  > I am trying to do a "for" loop so that %5 of $MaxNum is incremented.
                  >
                  > here is the NON cgi code for those who are going to freak at the "off
                  > topic" question, even thought it not really....
                  > Is there a better way? how would I do this with foreach?
                  >
                  >
                  > for $v0 ($v0=0;$v0<$MaxNum;$v0+($MaxNum/20);)
                  > {
                  > if ($v0 lt $InCastle && $v0<$v0+($MaxNum/20) )
                  (I don't have time to go over this in detail...)
                  ...but one obvious thing is 'lt' is for string comparisons. You want '<='

                  Paul


                  > {
                  > }
                  > else
                  > {
                  > }
                  > }
                  >
                  > and for those who can deal with it... the CGI code
                  >
                  > print qq|<td align=right><SELECT NAME="$ItemName">|;
                  > for $v0 ($v0=0;$v0>=$MaxNum;$v0+($MaxNum/20);)
                  > {
                  > if ($v0 lt $InCastle && $v0+($MaxNum/20) )
                  > {
                  > print qq|<OPTION SELECTED>$InCastle|;
                  > }
                  > else
                  > {
                  > print qq|<OPTION>$v0|;
                  > }
                  > }
                  > print qq|</SELECT></td>|;
                  >
                  > To those few who are gonna freak or be rude ....
                  > yeah... i'm clueless... please keep any acidic comments to yourself.
                  >
                  > Lou
                  >
                  >
                  >
                  >
                  >
                  >
                  > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  >
                  >

                  ---------------------------------------------
                  There are two major products that come out of
                  Berkeley: LSD and UNIX. We don't believe this
                  to be a coincidence. - Jeremy S. Anderson
                  ---------------------------------------------


                  Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html


                  Yahoo! Groups Sponsor
                  ADVERTISEMENT





                  ------------------------------------------------------------------------------
                  Yahoo! Groups Links

                  a.. To visit your group on the web, go to:
                  http://groups.yahoo.com/group/perl-beginner/

                  b.. To unsubscribe from this group, send an email to:
                  perl-beginner-unsubscribe@yahoogroups.com

                  c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



                  [Non-text portions of this message have been removed]
                Your message has been successfully submitted and would be delivered to recipients shortly.