If you get errors like:
BEGIN failed–compilation aborted at /usr/share/perl5/PVE/Tools.pm line 6.
And then with apt-get you are also getting perl errors, check the perl paths. Grab the list of not found dirs:
ls -la /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl | grep ‘no file’
-> fix that list, make them point to where you think they should, like:
/usr/local/lib/site_perl -> /usr/lib/perl5/
In my case 3 directory did not exist, and one was empty.
I just made symbolic links for them, and perl started working again.
And if you were doing the same thing as me, then continue installing proxmox with these great advices:
https://pve.proxmox.com/wiki/Upgrade_from_3.x_to_4.0