I want to inspect a perl array whether it provides a certain value.
How can I check if a Perl array contains a particular value? tells me that I could use grep( /^$value$/, @array ) in order to check whether $value is already contained in @array.
This works as long as $value doesn't have special characters. Unfortunately, my array elements are paths of a visual studio project which look like $(MY_USER_MACRO)/includes/myfile.h For these elements, grep( /^$value$/, @array ) always returns false although there are numerous of such entries already present in @array.
I assume that the problem occurs because $value has the $ character in it and therefore somehow breaks the grep execution.
Is there a way to tell grep to take the given string literally? If not: how could I solve my problem then?