in reply to While loop does not terminate
This simplified version code works as expected:
Please mark your updates as such: It is uncool to update a node in a way that renders replies confusing or meaningless.
But when I try to duplicated this in my real world code, it doesn't work.
Then one of the lines you deleted when going from your original program to your simplified version were the cause of the problem, and not the code you've posted here. Personally I'd probably start with looking at the return values of get_value() by unrolling the while's condition like so:
use warnings; use strict; use Data::Dump; my $cnt; sub get_value { $cnt++ < 10 ? 'initializing' : 'ok' } my $status; #while( !( ($status = get_value()) eq 'initializing' ) ) { while (1) { dd $status = get_value(); last if $status eq 'initializing'; print "X" } print "Y\n";
Update: "Disregard. This was a problem in the return value from get_value(), not the while loop test." - yep ;-)
|
|---|