Your teacher probably means that the way you find the perimeter for a square or a rectangle is the same, and that's right. For a square's perimeter, just add up the lengths of all of its sides. Same for a rectangle's perimeter.
So for a square that measures 6 inches long on each side, you'd just add 6+6+6+6 (add each side, remember) and you'd get 24 inches. You can also multiply by 4 (the number of sides that a square has), and you'll get the same thing: 4 x 6 = 24.
For a rectangle's perimeter, the operation is pretty much the same thing: If the longest sides are 12 inches each and the shortest sides are 5 inches each, then add 12+12+5+5 and you get 34 inches. Or you can multiply 2 times the longest side's length and 2 times the shortest side's length, and then add those two numbers together: 2 x 12 = 24, and 2 x 5 = 10; 24 + 10 = 34.