in reply to Re: how to rm an element from an array?
in thread how to rm an element from an array?
Why not a combination of the two solutions, something like:
That way, you could call it with one or more kill patterns, such as &yoink(\@arr, $kp), or &yoink(\@arr, $kp1, $kp2, $kp3), or so forth... (At least, I think it would work....)sub yoink { my ($array_ref, @kill_patterns) = @_; foreach my $kp (@kill_patterns) { @{$array_ref} = grep $_ ne $kp, @{$array_ref}; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re^2: how to rm an element from an array?
by blokhead (Monsignor) on Oct 28, 2002 at 03:52 UTC | |
by tobyink (Canon) on Feb 27, 2020 at 23:30 UTC |