in reply to to find an index of a particular value in an array
Here's a simpler quicker way; instead of the foreach loop and pattern matches which succeed on each line,
That gives all the lines containing the target $address.# my @lines = grep { -1 != index $_, $address } @contents; my @lines = grep { -1 != index $_, "=$address " } @contents; my @indexes = grep { -1 != index $content[$_], "=$address "; } 0 .. $#contents;
Update: Skeeve++ is correct, substring amended. Added index search.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: to find an index of a particular value in an array
by Skeeve (Parson) on Sep 22, 2005 at 11:18 UTC |