2 ms·
This issue is one of the things Perl 6 addresses well in my opinion. Regular ranges include their endpoints, and you can think of ^ as "not including" or "up t
by mclehman 9y ago
This issue is one of the things Perl 6 addresses well in my opinion.
Regular ranges include their endpoints, and you can think of ^ as "not including" or "up to (exclusive)"
1..5 is 1, 2, 3, 4, 5
1..^5 is 1, 2, 3, 4
1^..5 is 2, 3, 4, 5
1^..^5 is 2, 3, 4
There's also convenient shorthand for 0..^n (useful if you want to do something n times): ^n