How to turn a "random" number read from a text file into an array

I am trying to turn a number into a text file that I found with a regular expression, into a list of numbers starting from zero.

for example, the number 4I need to create an array consisting of 0,1,2,3.

How can I do that?

+3
source share
1 answer

You can use the range operator as:

@arr = 0..$number_read_from_file - 1;
+9
source

Source: https://habr.com/ru/post/1789508/


All Articles