All,
I am in the middle of writing a Perl script and have come across something a little perplexing. I am doing a "grep" to search for a term in an array:
if (grep /$someterm/,
@somearray){
print "Found the term in the array\n";
} else {
print "No term found in array\n";
}
Is there a way to return the element in the array if the term was found? For example, say the term is found, can I get the location of the corresponding element in the array.
For instance if the term was found at
@somearray[32], can I get that into a variable somehow?
Any help on this would be excellent.
Thanks..
Lucas Cochrane
lcochrane@dc.com