Remove dependance on switch.pm

switch.pm is removed from perl in in versions above 5.10
This removes the dependance on switch and replaces with native perl.