use Getopt::Long(qw/GetOptionsFromString/);
my $tag;    # option variable with undef default value
GetOptionsFromString('--tag', 'tag:s' => \$tag);

if (defined $tag) {
    if ($tag eq '') {
        $tag = '7.7.7.7';
    }
    print $tag;
}
else {
    print 'No option supplied';
}