Update: This was intended as a reply to this post.
can i compare individual string with complete array ...
I don't have the time or means at the moment (I have no easy access to Excel) to build an Excel test spreadsheet and write a test script to run against it. I also, of course, cannot examine your code in the context of the full script in which it works. What happens when you run this code (perhaps in a small test script) against your own test spreadsheet? Are the results as you expect? Do you understand the example code given here? I mentioned the (?i) regex "operator" in that reply just for your information; I didn't mean to imply that it was necessary to use it.
Just by visual inspection, I can make some comments on the code.
The
grep { /(?i)\Q$db_description\E/ } @steps_name
expression in your code will evaluate true (in boolean context) if $db_description is a case-insensitive match with any element in the @steps_name array. This seems in accord with the messages being printed in the true/false clauses of the if-statement.
However, in the
print "<br><h1>Element '$db_description' found $steps_name[$row+1] --- $seq_code[$row+1] !</h1></br>" ;
statement, the $row variable has a range of up to 50 (in your example code), and the @steps_name array has only four elements. The $row+1 index can potentially be far outside the bounds of the @steps_name array! I don't understand this bit. I also have no idea what's in the @seq_code array and so cannot comment further.
The
my $needle_regex = quotemeta $db_description;
statement is completely unnecessary; $needle_regex is never used, and \Q$db_description\E in the regex completely meta-quotes the interpolated variable.
Good questions get good answers. I must say I find your question confusing, and it's a bit frustrating to try to answer it.
Give a man a fish: <%-{-{-{-<
In reply to Re^4: regex for case insensitive
by AnomalousMonk
in thread regex for case insensitive
by rohan_532
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |