if ($string=~m/:/g || length($string)!=16) { print "Either : already in string on the length is invalid\n"; exit; } else { work on that string }