In Perl, I need to read a .conf file that contains either a 0 or a 1. If the value is one, I need to execute whatever is in the if statement. Here is what I have now:
open(CONF, "/var/web/onhit.conf");
if(<CONF>) {
print "Hello World!";
}
close(CONF);
The contents of the if statement always evaluate, even if the .conf file contains a 0. I know the file reading is correct because this code can read the file correctly:
open(CONF, "/var/web/onhit.conf");
print <CONF>;
close(CONF);
If the file contains a 1, it prints a 1, and vice versa. Does anyone know what is wrong with my first snippet? Sorry, but I am a n00b at Perl. :-)