Perimeter is the total distance around the outside of a shape — you're just adding up all the side lengths. For a rectangle with length $l$ and width $w$: $$P = 2l + 2w = 2(l + w)$$
For any other shape, just add every side. In compound shape problems it's easy to miss a side or accidentally include an interior line, so I'd always sketch the shape first and tick off each side as you go.
Algebraic perimeter questions ask you to write an expression or form an equation. For example, a rectangle with sides $(x + 3)$ and $2x$ has perimeter: $$P = 2(x + 3) + 2(2x) = 2x + 6 + 4x = 6x + 6$$
If you're given the perimeter and need to find $x$, set your expression equal to the given value and solve like a normal linear equation.
