Actually, people made formulas for polygons, but in another way, the definition of the perimeter is the sum of the lengths of all sides. Example:
It has length and width right? so you can write it as:
or if you factor it out;
It has all sides equal right?
sometimes it doesn't have equal sides
but if it is equal
Hope this helps =)