Thanks for the help. That is exactly my problem. I have worked out a way around it by identifing the element and splicing it outside of the foreach loop.
Thanks, Tad -----Original Message----- From: King, Jason G [mailto:[EMAIL PROTECTED]] Sent: February 18, 2003 4:19 PM To: [EMAIL PROTECTED] Subject: RE: Deleting an Element in an Array of Hashes Tad writes.. >I am trying to delete a entry in an array of hashes. The entry is >deleted properly but the array size does not diminish. What makes you think that the entry is deleted properly? Your code does not delete the entry in my testing. Problem comes because you're doing a splice within a for loop that includes an array (see "Foreach Loops" in perlsyn), basically you just shouldn't ever do a splice inside a for loop that's iterating over the same array that you're splicing. This has the same semantics as what you appear to be doing, perhaps you can use it instead: sub DeleteHash { my $szpackage = shift; grep { lc $_->{package} ne lc $szpackage } @_; } -- Jason King _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
