You may also find this useful. Regards, Paul
From: Bruce Hudson [EMAIL PROTECTED] Sent: Friday, 6 September 2002 10:29 PM To: Keirnan, Paul Subject: Re: [Perl-unix-users] Re: Remove item from array > That is, create a new array without one of the elements. > > I then made it look like > > > @array = ('val1','val2','val3','val4','val5'); > > > > @new_array = (); > > foreach (@array) { > > push (@new_array, $_) if (!/val2/); > > } > > ..... You can also use the grep function to iterate over the array and select only some elements. @new_array = grep (($_ ne 'val2'), @array); @assocs2 = grep ((!m/cn=DudDriver/), @assocs)); I'd find this code easier to read some time later but YMMV. -- Bruce A. Hudson | [EMAIL PROTECTED] UCIS, Networks and Systems | Dalhousie University | Halifax, Nova Scotia, Canada | (902) 494-3405 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pasi Valkeila Sent: Tuesday, 26 October 2004 1:25 AM To: [EMAIL PROTECTED] Subject: [Perl-unix-users] deleting from array Morjesta vaan! How can I delete a value from the middle of an array so that the array shortens by one? Like this (1, 2, 3, 4, 5, 6, 7) ----> (1, 2, 3, 5, 6, 7) Pauli _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ********************************************************************** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ********************************************************************** _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs