A surgical stapler includes a proximal end and a distal end and an anvil at the distal end for providing resistance to staples during the stapling operation of the surgical stapler. The anvil may include a number of segments arranged end-to-end. The anvil is elongated in the collapsed state, the anvil being elongated generally in a first direction D1. The anvil is configured such that the segments rotate about a rotation axis along a perpendicular second direction D2 when the anvil is actuated between the deployed and the collapsed states. The anvil is configured such that adjacent segments pivot relative to each other about a pivot axis along a third direction D3 when the anvil is actuated between the deployed and collapsed states. The stapler also includes an actuator mechanism, wherein the actuator mechanism is configured to be controlled from a location on the surgical stapler towards the proximal end.