Help for this page

Select Code to Download


  1. or download this
    $idx = 45; # pretend we've already found the insertion point
    @a[$idx+1 .. $#a+1] = @a[$idx .. $#a];
    $a[$idx] = $newitem;
    
  2. or download this
    $idxmove = $#a;
    while ($idxmove >= $idx) {
    ...
      $idxmove--;
    }
    $a[$idx] = $newitem;