The
split is unnecessary for validating VLAN numbers and names.
Here is sample validation code for vlan name:
if ( $vlan_name =~ m|^\w[\w-]*$| ){
# Name complies with :
# * At least one char
# * Starts with a letter, number or underscore
# * Contains only alpha, num, underscore, hyphem
}else{
# Complain about non-compliant name
}
Similarly, the vlan number numeric check should be:
if ($vlan_number =~ m|^\d+$|) {
# Compliant - numeric only
}else{
# Something Not completely numeric - display error.
}
Potentia vobiscum ! (Si hoc legere scis nimium eruditionis habes)