Here is my way:

if(scalar(grep(/^$object$/, @Equipped))) {
@Equipped= grep { $_ ne $object } @Equipped;}

It searches the array @Equipped for an objext if it finds it then removes it
be searching threw the whole array and skiping the object as it assigns it
to the array.  Hope this helps.

Regards,
André C.
Technical Support
Ô¿Ô¬
----------------------------------------------------------------------------
-
Visit our support manual at http://supportmanual.com/
----- Original Message -----
From: "Rob Roudebush" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 15, 2002 4:21 AM
Subject: Match and remove an element in an array


>
>  Okay my script takes names from a fom and puts them into an array - then
later I need to match a $variable (one of the names) against that array and
take that specific element out of the array. I figure there is probably an
easy function to do this?
> @array=(john, lucy, mike);
> $name=john
> I need to modify the array and remove john.
>
>
>
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to