in reply to Re: lsearch for perl?
in thread lsearch for perl?
Things like this
aren't in the man-page, and got me thinking. This however:@list = grep { $item ne $_ } @list;
was a real satori, Keanu-Reeves-like "Whoah!!" moment for me. The idea of using grep on a list without naming _that_ list as the argument to grep would never have occurred to me. Guess I was stuck in Unix grep thinking!my ($index) = grep { $item eq $list[$_] } 0..$#list; splice(@list, $index, 1) if defined $index;
Feeling quite humbled.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: lsearch for perl?
by ikegami (Patriarch) on Dec 06, 2005 at 15:33 UTC |