Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Re: Removing Items from an Array

by UnderMine (Friar)
on Dec 03, 2002 at 21:52 UTC ( [id://217362]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @arraynew = grep { foo($item) } @array;
    if ($#arraynew != $#array) {
       # do something when item removed
    }
    
  2. or download this
    my @arraydelete = grep { !foo($item) } @array;
    @array = grep { foo($item) } @array;
    foreach my $item (@arraydelete ) {
       # do something when item removed
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://217362]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-03-19 06:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found