in reply to grep usage confusion
my @index2 = grep($_ ne "fourthy", @coins);
I guess you meant
ormy @index2 = grep {$_ ne "fourthy"} @coins);
because in the way you have written it, it would not work (grep needs to eval the first argument (block or string) repeatedly for each item in the argument list).my @index2 = grep('$_ ne "fourthy"', @coins);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grep usage confusion (eval)
by tye (Sage) on Oct 14, 2008 at 18:07 UTC | |
by rovf (Priest) on Oct 15, 2008 at 08:33 UTC |