^ is a range-creating operator or the so-called upto operator. It creates a range (which is an object of the Range type) from 0 up to the given value (not including it).
.print for ^5; # 01234
This code is equivalent to the following, where both ends of the range are explicitly specified:
.print for 0..4; # 01234