On rank and kernel of perfect codes