my @args = split /\./, $mystring; pop @args while (@args and !$args[-1]); dosumpton(@args);