Here's a simple version...

$a = 5;

while ($a) {
     foreach (1..10) {
         if ($_ == $a) {
             $exit++;
         }
     }
     last if ($exit);
}
print "\$a is $a\n";


R

At 20:20 27/09/2002 -0700, Michael Kelly wrote:
>On Fri, Sep 27, 2002 at 08:29:53PM -0500, Grant Hansen wrote:
> > Can anyone provide an example of how to use a state variable to break 
> out of a
> > loop?
> >
> > Thanks
>
>I smell homework.
>
>But to be fair: what do you have so far? Why doesn't it do what you want?
>If you showed us your code where you were trying to use a state variable
>to break out of a loop, you'd be more likely to get an answer.
>
>--
>Michael
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to