5. (10 points) The octagon in the figure is obtained by cutting out a small rectangle from a large rectangular sheet of paper. Then, at least ( ) line segments' lengths need to be known to calculate the perimeter of this octagon.
A. 4
B. 3
C. 5
D. 10
【Analysis】By translating line segment (1) to the position of (2), a large rectangle can be formed, which allows us to determine the number of line segments needed to calculate the perimeter of this octagon.
【Solution】Solution: As shown in the figure above, by translating line segment (1) to the position of (2), a large rectangle can be formed. The 4 sides of the large rectangle are equal in pairs, so we only need to know the lengths of two adjacent sides,
(3)=(4), so we only need to know the length of 1 line segment,
Therefore, to find the perimeter of the octagon, we need to know: $2+1=3$ line segments.
Hence, the correct choice is: $B$.