I think you misunderstood me (and read my flawed code for help), because what I meant was that 0 and 255 are *NOT* valid values for a *host* in the last octet, but you're right, they're valid anywhere else (except of course, a 0 in the first octet unless you're using all-zeros broadcast, which is non-standard by modern convention, or a 255 in the first octet, which is valid only for broadcast addresses). But that's pedantic.
If you want to do a complete test, the NetAddr::IP module from CPAN (or just use the trick of trying to open a socket with the address and see if it works).
But I did make a mistake; the regexp I wrote does needs to account for 0's in the last octet, provided that the last octet does not contain *only* zeros. So a more correct version would be this, if you wanted to ONLY verify *HOST* addresses and not broadcasts or subnets (please note: the regexp below does not prohibit '255' values in the first or last octet, which are technically invalid for *host* addresses):
unless ($get
&& $get =~ /^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[1-9][0-9]{0,
+2}$/
&& !grep { $_ < 0 || $_ > 255 } split(/\./, $get) )
{ print "BAFFLING: invalid target specified\n"; exit(-
+1);}
Signature void where prohibited by law.