Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: While loop does not terminate

by haukex (Archbishop)
on Dec 13, 2020 at 16:52 UTC ( [id://11125121]=note: print w/replies, xml ) Need Help??


in reply to While loop does not terminate

Sorry, I can't reproduce this; if get_value() returns 'initializing', then the loop terminates immediately.

use warnings; use strict; my $cnt; sub get_value { $cnt++ < 10 ? 'initializing' : 'ok' } my $status; while( !( ($status = get_value()) eq 'initializing' ) ) { print "X" } print "Y\n";

Just prints one Y.

Edit: This was posted before the root node was updated, see my reply here.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11125121]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found