The period could be expressed as $T = \alpha \times m^{A}g^{B}l^{C}$ where we need to choose A, B, C such that the dimensions on both sides of equation agrees. $\alpha$ is a constant which can be found by experiment.
The acceleration of gravity has dimensions $L/T^2$ (meter per second squared).