in reply to Re: Array element getting deleted
in thread Array element getting deleted

ELISHEVA (and other repliers) are offering great advice and council. In addition to the variety of suggestions offered, they also point out one real root, from my perspective, of the problem the OP is facing...i.e., $_ is a global variable. So the subroutine ends up overwriting it.

This is a clasic example of where the Perl gurus advise that it is important (and the only way for special variables like $_) to use the 'local' function to keep from overwriting it in the subroutine.

ack Albuquerque, NM