Question: So I'm trying to put all numbered domains into on element of a hash doing this:

```
### Domanis ###
my $dom = $name;
$dom =~ /(\w+\.\w+)$/; #this regex get the domain names only
my $temp = $1;

if ($temp =~ /(^d+\.\d+)/) { # this regex will take out the domains with number 
    my $foo = $1;
    $foo = "OTHER";
    $domain{$foo}++;
}
else {
    $domain{$temp}++;
}

```

where `$name` will be something like:

```
something.something.72.154
something.something.72.155
something.something.72.173
something.something.72.175
something.something.73.194
something.something.73.205
something.something.73.214
something.something.abbnebraska.com
something.something.cableone.net
something.something.com.br
something.something.cox.net
something.something.googlebot.com

```

My code currently print this:

```
72.175
73.194
73.205
73.214
abbnebraska.com
cableone.net
com.br
cox.net
googlebot.com
lstn.net

```

but I want it to print like this: 

```
abbnebraska.com
cableone.net
com.br
cox.net
googlebot.com
OTHER
lstn.net

```

where `OTHER` is all the numbered domains, so any ideas how?

Answer: 
Just do a rand between only 2 values then use an if. So:

```
$randval = rand(0,1);
if($randval == 0)
    $value = 3;
else
    $value = 5;

```
You know that you have 2 values so you can do something like this:

```
$rand = rand(1,2);
if ($rand == 1)
    $val = 3;
else
    $val = 5;

```