There are a few issues with your post:
- It would help if you provide SHORT, RUNNBLE CODE that demonstrates the issue
- It would help if code were indented properly - that would allow others to see loop boundaries
- You have misunderstood how to process the return value from fetchall_arrayref
- You have a syntax error in "while ( $status eq 'PAID') ) {"
- Your "redo" will not work the way you seem to expect
Please try to understand and use standard perl "idioms" - they help make code more understandable and avoid bugs.
Here is an idiomatic flow for your case:
my $query = $dbh->prepare("SELECT ordernumber FROM orders ORDER BY cre
+ated ASC");
$query->execute();
####### FUNCATION (A)
while( my $row = $query->fetchrow_arrayref() )
{
my $ordernumber = $row->[0]; # First, and only field in returned
+list
# WHEN I PRINT THE OUTPUT IS
# 545455
# 745454
# 645450
# NOW I WANT TO CHECK EACH ORDER NUMBER VIA LINK
# ITS LIKE I WANT TO RUN HTTP REQUEST FOR EACH ORDER NUMBER
my $url = "LINK/$ordernumber";
print "URL: $url\n";
my $req = HTTP::Request->new(GET=>$url);
my $resp = $ua->request($req);
my $response = JSON::XS->new->decode ($resp->content);
my $status = $response->{status};
# WHILE WE GET ORDER NUMBER WITH MATCHING RESLUTS
while ( $status eq 'PAID') {
#// DO STAFFS HERE
#// WHEN DONE THEN KEEP CHECKING OTHER ORDER NUMBER USING REDO
}
#no redo; # REDO FUNCATION (A) AFTER SUCCESS - ITS LIKE RESTART T
+HE WHOLE FUNCATION AGAIN
# BEACUSE AFTER SUCCESS, I HAVE TO KEEP ALSO CHECKING REAMI
+NING ORDER NUMBER STATUES
}
$dbh->disconnect();
"Imaginary friends are a sign of a mental disorder if they cause distress, including antisocial behavior. Religion frequently meets that description"