ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:
Hello dear monks,
I wrote the following code:
I wrote the following code:
When I run it (and the data got to the DB), I get: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`; }
Why does it enter in the if-statement if $content != "[]?[{"_id":"123125125","files":6,"user":"abcasda","timestamp":1571685134, +"runtime":3,"run_name":"checking"}] check:1 Failed to report. Successfully reported.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Equality of strings
by huck (Prior) on Oct 21, 2019 at 19:40 UTC | |
by ovedpo15 (Pilgrim) on Oct 21, 2019 at 19:42 UTC | |
Re: Equality of strings
by Corion (Patriarch) on Oct 21, 2019 at 19:41 UTC | |
Re: Equality of strings
by stevieb (Canon) on Oct 21, 2019 at 19:48 UTC | |
Re: Equality of strings
by 1nickt (Canon) on Oct 22, 2019 at 00:29 UTC | |
by wanna_code_perl (Friar) on Oct 22, 2019 at 00:54 UTC | |
by 1nickt (Canon) on Oct 22, 2019 at 02:06 UTC |
Back to
Seekers of Perl Wisdom