⭐ in reply to How do I find the index of a specific array value?
Using merlyn's example with regular expressions, so you don't need to know the exact value of the element you are matching;
Replace ( $index ) with an array to match multiple instances.my @array = ( 'Name: Mr. Jones', 'Phone: 555-555', 'Email: jones@example.com' ); my ( $index )= grep { $array[$_] =~ /Phone/ } 0..$#array;
|
|---|