in reply to Re^2: how to rm an element from an array?
in thread how to rm an element from an array?
sub yoink(\@$) { my ($array_ref, $remove) = @_; @$array_ref = grep { $_ ne $remove } @$array_ref; } my @arr = qw/un deux trois quatre cinq six sept huit/; # no passing of \@arr -- oh, so pretty! yoink @arr, 'deux'; print "@arr\n"; __END__ un trois quatre cinq six sept huit
blokhead
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: how to rm an element from an array?
by tobyink (Canon) on Feb 27, 2020 at 23:30 UTC |