AtomicPorkchop
AtomicPorkchop

Reputation: 2675

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

I am trying to turn a number in a text file I find with regex into a list of numbers starting with zero.

for example, the number is 4 I need to make an array that comprises of 0,1,2,3.

How can this be done?

Upvotes: 3

Views: 115

Answers (1)

codaddict
codaddict

Reputation: 455460

You can use the range operator as:

@arr = 0..$number_read_from_file - 1;

Upvotes: 9

Related Questions