How do you store a result to a variable and check the result in a conditional?
Posted
by Oesor
on Stack Overflow
See other posts from Stack Overflow
or by Oesor
Published on 2010-04-22T19:51:47Z
Indexed on
2010/04/22
19:53 UTC
Read the original article
Hit count: 187
perl
I know it's possible but I'm drawing a blank on the syntax. How do you do something similar to the following as a conditional. 5.8, so no switch option:
while ( calculate_result() != 1 ) {
my $result = calculate_result();
print "Result is $result\n";
}
And just something similar to:
while ( my $result = calculate_result() != 1 ) {
print "Result is $result\n";
}
© Stack Overflow or respective owner