Based off your very limited description, I'm surmising that $mk contains a return delimited list of folders and you're trying to determine if $folder is present.
As davido already pointed out, grep is not what you need for this because that is meant only for array operations. If you're just working on a scalar, you can do the test directly. Secondly, based off your regex, I suspect your problem is you're not using the 'm' modifier which would make it so ^ and $ matched the beginning and end of any line within the text, not just the start and end of the string.
Here's an example that does match like you want
my $mk = <<'END_LIST'; /foo/bar /foo/baz /eep/foo/bar /epp/foo/baz /biz /baz/foo/bar END_LIST my $folder = '/foo/baz'; my $folder_present = $mk =~ /^\Q$folder\E$/im; print "$folder_present"; # Prints 1
- Miller
In reply to Re: Grep failing
by wind
in thread Grep failing
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |