Wouldn\'t $remove($1-,etc) do the same thing as $truedeltok? Also, you are lacking much error checking here.