So I am just picking up Perl to learn and this simple string conditional is boggling my mind. Where is my syntax incorrect?
my $var = "hello";
if ( $var == "goodbye" )
{
print "goodbye everyone!";
}
else
{
print "no goodbye's today";
}
my output:
goodbye everyone!
What is up with that? $var != "goodbye"... but the script seems to think it is. I have not had this trouble with ints and floats, so I am assuming this is something to do with my string syntax regarding where to use quotes properly.
Anyways, can anyone tell me what I am doing wrong?
my $var = "hello";
if ( $var == "goodbye" )
{
print "goodbye everyone!";
}
else
{
print "no goodbye's today";
}
my output:
goodbye everyone!
What is up with that? $var != "goodbye"... but the script seems to think it is. I have not had this trouble with ints and floats, so I am assuming this is something to do with my string syntax regarding where to use quotes properly.
Anyways, can anyone tell me what I am doing wrong?