I think perhaps you mean:
next unless $hfileline =~/^\S*\s+$hNames/;
You want to match a "hosts" line where you have an IP (\S*) followed by whitespace (\s+) followed by the hostname.
Perhaps a better regex would be:
next unless $hfileline =~/^[\d.]+\s+$hNames/;
To force matches against real lines, and not match against commented-out entries.
Another way to match an IP address without using "<= 255" is:
if( $vmServerIP =~ m/^(?:(?:\d|[1-9]\d|1\d\d|2(?:[0-4]\d|5[0-5]))\.){3
+}(?:\d|[1-9]\d|1\d\d|2(?:[0-4]\d|5[0-5]))/ ){