Hmm - no, interpolation doesn't work the way I interpret your post:
my $backslash= '\\'; print "This is a backslash: ->$backslash<-\n"; print "Two backslashes: ->$backslash$backslash<-\n"; print "Two backslashes and a 't' (not a tab): ->$backslash${backslash} +t<-\n"; print "One backslash and a 't' (not a tab): ->${backslash}t<-\n"; __END__ This is a backslash: ->\<- Two backslashes: ->\\<- Two backslashes and a 't' (not a tab): ->\\t<- One backslash and a 't' (not a tab): ->\t<-
So once a backslash has been stored in a variable, interpolating that variable into other values won't trigger escape sequences. eval will do, and using that string within regular expressions (without quotemeta) will also get the value interpreted anew, evaluating escape sequences.
Still, from a viewpoint of compatibility, as long as you don't have to pass the filenames to outside programs, using forward slash instead of backslash is still preferrable.
In reply to Re^4: read and write file in directory
by Corion
in thread read and write file in directory
by codewalker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |