while (1) { $sqs->ReceiveMessage({ QueueUrl => $queue_url, }); my $data = $sqs->data; if ( defined $data->{...}{Message} ) { process_image($data->{...}{Body}); } sleep 10; }