You need to be careful not to delete the wrong (multiple) students too. For the examples that waswas-fng and pzbagel gave, if you attempt to delete student 12 (John), it will also delete users 120-129. . . You might want to consider using a hash with the student number as the key instead of the arrays to prevent that.