Case Insensitive Grep Search
Posted on 2003-03-14
I have the following piece of code to search an array for a user specified value:
@packages = grep /$value/, @array;
However, the search is case sensitive, so I tried adding the -i flag for grep:
@packages = grep -i /$value/, @array;
Unfortunately this causes the code compilation to fail, giving me the following error message:
Unrecognized file test: -i at [file name, line number]"
Am I using the -i flag wrong? Or is there another way to do this?
Any help would be greatly appreciated. Thanks in advance.