http://qs1969.pair.com?node_id=11137063


in reply to loop iterator in a string

This is pretty close to what you want. Use eval to evaluate the operators in the string.
use strict; use warnings; my $arr=[1,2,3,4,5,6,7]; my $loop="2,4..5"; splice @$arr,$_,0,999 foreach(eval $loop); $, = ' '; print @$arr

OUTPUT:

1 2 999 3 999 999 4 5 6 7
Bill