If you want to test for equality, then by all means!
if ( grep { $index == $_ } @index_corr_file )
{
# whatever
}
| [reply] [d/l] |
This will help you,
grep(/^$index$/, @index_corr)
update:
As edan said, it will help you
grep{$index==$_} @index_corr
| [reply] [d/l] |
I downvoted your post, and I'll tell you why - IT'S WRONG! Why would you give somebody a regex solution when they clearly need to test for equality!? What if $index contained regex metacharacters? In short, I think it's a bad habit to use an anchored regex when you mean "equals". perl provides us with == and eq for a reason. Use them.
| [reply] |