in reply to remove value from array without index
You were pretty close with your use of grep.
#!/usr/bin/perl use strict; use warnings; my @terms = qw(a list of terms); my $term = 'of'; @terms = grep { $_ ne $term } @terms; print "@terms";
Note that this is one of those cases where the use of regexes makes things more complex that necessary.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|