Hello
This is a simple problem and I am sure it is staring me in the face. The page below loads and reads an XML value by get. The value will always be either "true" of "false". If I print the value to screen I can see clearly that it only every equals one of those 2 values, however, my if clause isn't working? That is, even though when $get is equal to false the text doesn't print.#!/usr/bin/perl use strict; use LWP::Simple; use XML::Simple; use CGI; print "Content-type: text/html\n\n"; my $q = CGI->new; my $post = 'http://192.168.1.45/web/powerstate'; my $power = $q->param('power'); if($power eq "toggle") { get("$post"."?newstate=0"); } print "<br />"; my $get = get($post); chomp $get; # THIS PART IS FAILING if($get eq "false") { print "Box is currently on"; } print $get; print <<HTML; <form method="post" action="power.pl"> <input type="hidden" name="power" value="toggle"> <input type="submit" value="Change Power State"> </form> </body> HTML
In reply to Posted Value "eq" not working by packetstormer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |