I would not describe that as magic.
Range Operators (written as
..) produce a list of integers between the two limits. As described in
Variable names,
$#array returns the index of the last element of
@array. "Magic" usually involves (from my perspective) either action-at-a-distance or Perl typing in the background. These are just operators.