http://www.perlmonks.org?node_id=11107784

ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:

Hello dear monks,
I wrote the following code:
do { $content = make_get_request($url_reports); $tries--; } while ($content == "[]" && $tries > 0); print $content."\n"; print "check:".($content == "[]")."\n"; if ("$content" == "[]") { print "Failed to report.\n"; } else { print "Successfully reported.\n"; } sub make_get_request { # Builds cmd for checking in API return `$cmd`; }
When I run it (and the data got to the DB), I get:
[{"_id":"123125125","files":6,"user":"abcasda","timestamp":1571685134, +"runtime":3,"run_name":"checking"}] check:1 Failed to report. Successfully reported.
Why does it enter in the if-statement if $content != "[]?