Fix perl compilation
Added Visual C++ support + some minor fixes