in reply to Re: Looped around my neck (help with my poor little loops!)
in thread Looped around my neck (help with my poor little loops!)

If the way you wrote it works you definately make me think I wrote the whole thing backwards, in reverse and in some non-textual language, lol. The only thing I don't understand is what you mean by:

FOR $loop from 1 to $max_tries $guess_count = $loop
Are you saying I should do a:

for ( increment # of guesses to $max_tries) { # no clue what the 2nd line means then
? Thanks so much for your help, looks like I totally globbed this script up.

"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Replies are listed 'Best First'.
Re: Re: Re: Looped around my neck (help with my poor little loops!)
by poj (Abbot) on Mar 15, 2003 at 23:54 UTC
    I found that when you jump out of the loop with last you lose the value of the $loop variable
    If you need it later like in the message you need to store it with $guess_count=$loop, that's all it does
    poj
      Ok, I'm slow so please forgive me. I've never heard of a loop variable unless you mean any variables contained within the loop itself not being able to be used outside of the loop unless it's a global variable. Or is $loop a built in variable I haven't heard of before? *sigh* If you find the book of all knowledge please feel free to lend it to me, lol.

      Thanks for your help.

      "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

      sulfericacid
        OK, maybe $loop was not a good choice, let's use $n
        for my $n (1..10){ print 'My $n variable is : ',$n,"\n"; }
        or nothing
        for (1..10){ print 'My $_ variable is : ',$_,"\n"; }
        poj

        What he was giving you is called pseudocode. Basically, it means stating the solution as a series of steps in more-or-less plain english. This would then be translated by the programmer into source code.

        --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';