Check for defined $daemsintall
instead. If it is defined, the corresponding option was specified; now you can compare it to an empty string to see whether or not it was set to some value.
Example (it uses GetOptionsFromString method, but the approach is the same):
use Getopt::Long(qw/GetOptionsFromString/);
my $tag;
GetOptionsFromString('--tag', 'tag:s' => \$tag);
if (defined $tag) {
if ($tag eq '') {
$tag = '7.7.7.7';
}
print $tag;
}
else {
print 'No option supplied';
}
And here's IDEOne demo.