lets say i have an array :
@time = qw(
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
);
but the values 1..50 depend on the size of an array @arr
so instead of declaring @time manually, how can i populate @time with 1 .. @arr, and possibly have other TYPES of elements like TIME in seconds, etc.
This will initialise
@timewith the values from1to$#arr:I suspect you probably want
0 .. $#arrrather than1 .. $#arr?I’m not quite sure what you mean here, but you should have a look at map for one convenient way of generating a list of values by transforming another list. That might be what you’re after.