Hi,
The problem in your code is that you have assigned $vl1, $vl2 and $vl3 as values to hash keys:
my %vlan = (
"VLAN1" => $vl1,
"VLAN2" => $vl2,
"VLAN3" => $vl3,
)<br>
BUT the values of these variables are 'assigned' much later through user input. At the time of 'initialisation' of hash, these values are null; The user input is taken much later, by which time, the hash values are already set to null.
Hopefully someone else will post a full solution for you here, but due to time constraints I cannot. Hope this information is helpful to begin with!