in reply to grep Question
Hello Shivam05, and welcome to the Monastery!
Your code has two problems. First, you need to disable the metacharacters in $grepper when using it in a regular expression:
my @LABEL = grep(/\Q$grepper\E/, @array);
See quotemeta.
Second, as others have noted, you set the value of $array[0] to label(, which does not contain the double-quote character. Therefore, the regular expression finds nothing to match in @array. You can fix this in several ways:
$array[0] = "label(\""; $array[0] = 'label("'; $array[0] = qq{label("}; $array[0] = q{label("};
See perlop#Quote-and-Quote-like-Operators
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|