@a = qw(aaa bbb ccc ddd); # To insert 'NEW THING' at position 2: splice(@a, 2, 0, 'NEW THING');
# To duplicate element $index in array @a splice(@a, $index, 0, $a[$index]);Use push() when you want to add something at the end.
@a = qw(aaa bbb ccc ddd); # To insert 'NEW THING' at position 2: splice(@a, 2, 0, 'NEW THING');
# To duplicate element $index in array @a splice(@a, $index, 0, $a[$index]);Use push() when you want to add something at the end.