The "@ipaddress#" macro returns a 15 character string containing the IP address. The address 1.1.1.1 would look like: "1 .1 .1 .1 " - note that each octet has three characters, even if they are spaces. You might use the split command to create an array:
$aryIP = Split(@IPADDRESS0, ".", -1)

This will place each string of three chars (with spaces) into an array element. Remembering that Arrays start with zero, $aryIP[2] would contain "10 " (using your assumption). Lets assign that array value to a variable, just to keep the Var names straight..
$subnet = $aryIP[2]

The simpler alternative -
$subnet = SubStr(@IPADDRESS0, 9, 3)
- also places characters 9-12 into the variable. I illustrated the split command because it is powerful and often overlooked. It might even be preferred in this situation if you needed to examine multiple octets.

Testing the variable from either method to be equal to "10" would fail, because the variables actually contain the trailing space!

You could account for this:
If $subnet = "10 "
but this isn't good practice.. It's too easy to overlook the space when making future modifications.

You could convert to a number:
$subnet = Val($subnet)
Or, you could remove the spaces:
$subnet = Trim($subnet)

Now testing for equality with "10" would work, and the rest of your script should function.

A few comments from an old hacker.. developing a style is important, especially when you review your code months later (or when you ask someone else to look it over).

* Make variable names stand out - use $CAPS
* Use ID references for special vars, like arrays: $aryADDRESS
* Indent your IF and LOOPing statements so you can easily tell where they begin and end.
* Use comments liberally. Go back and review a script you wrote 6 months ago and you'll understand what I mean.

Well, accounting for inflation, that's my $0.56!

Hope it helps.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D