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

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
  • Comment on Re: Re: Re: Looped around my neck (help with my poor little loops!)

Replies are listed 'Best First'.
Re: Re: Re: Re: Looped around my neck (help with my poor little loops!)
by sulfericacid (Deacon) on Mar 16, 2003 at 00:00 UTC
    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';