The original rectangle had a perimeter of 2 \times 30\text{cm} + 2\times 40\text{cm} = 140\text{cm}.
Each of the new squares that is cut out adds three sides of 5\text{cm} each (shown in black on the diagram), and removes one portion of length 5\text{cm} (shown in green).
This means the overall effect of cutting out each square is to increase the perimeter by 10\text{cm}. Since are ten squares, the overall increase is 10 \times 10 \text{cm} = 100\text{cm}.
Therefore the final perimeter is 140\text{cm} + 100\text{cm} = 240\text{cm}.