quoting variables in regexp patterns
authorMatthias Förste <foerste@schlittermann.de>
Mon, 04 Oct 2010 16:29:37 +0200
changeset 33 9f628506a2e3
parent 32 c6b6c0366342
child 35 705425612757
quoting variables in regexp patterns
tele-watch.pl
--- a/tele-watch.pl	Fri Mar 13 16:22:06 2009 +0100
+++ b/tele-watch.pl	Mon Oct 04 16:29:37 2010 +0200
@@ -217,11 +217,11 @@
                 # change the link targets
 
                 # find the links pointing to the $target/
-                foreach my $link (grep { -l && readlink =~ /^$target\// }
+                foreach my $link (grep { -l && readlink =~ /^\Q$target\E\// }
                     dir "$fullname/")
                 {
                     my $x = readlink($link);
-                    my ($t) = ($x =~ /^$target\/(.*)\/$from_base$/);
+                    my ($t) = ($x =~ /^\Q$target\E\/(.*)\/\Q$from_base\E$/);
 
                     my $y = "$target/$t/$e->{name}";