Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: how to rm an element from an array?

by tobyink (Canon)
on Feb 27, 2020 at 23:30 UTC ( [id://11113526]=note: print w/replies, xml ) Need Help??


in reply to Re: Re^2: how to rm an element from an array?
in thread how to rm an element from an array?

Slightly different, but I quite like this:

sub yoink (&\@) { @{$_[1]} = grep !$_[0]->($_), @{$_[1]} } my @arr = qw( aa bb cc ); yoink { $_ eq 'bb' } @arr; print "@arr\n";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-23 20:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found