While ( my_condition ) { $buffer = $array[0]; $array[0] = new_value; mytestfunc(\@array); $array[0] = $buffer while ($array[0] != $buffer); }