I’m trying to make the script exit when a blank query is entered. From what I’ve read, this code should work fine, but doesn’t seem to want to, because “” isn’t numeric. What is the workaround?
if(($#ARGV < 0) || ($ARGV[0] == "")){
print "$0: Enter a query.\n";
exit 1;
}
To clarify,
perl run.pl "query"
should work, while
perl run.pl ""
should prompt for a string.
Try
eqfor string comparison.