Answer:
Both of them are correct.
The perimeter is found by adding up all four sides. If you notice, one of them is width and one of them is length. A rectangle has four sides, two width and two length.
l= length and w=width so P=2l+2w.
But, we can combine them by factorizing 2l+2w.
Lets see what we can pull out. We can only pull out 2.
2(l+w)=2l+2w.
2(l+w)=P
Both of them are correct.
Hope this helps plz hit the crown :D