> >> > #!/usr/bin/perl > >> > ## set up for output to be sent to browser > >> > print "Content-type: text/html\n\n"; > >> > ## read in mp3store.html > >> > if (open (INFILE, "<../../mp3store.htm")) > >> > { > >> > foreach $line (<INFILE>) > >> > { > >> > $line =~ tr/images\//..\/..\/images\// > >> > >> $line =~ s/images\//\.\.\/\.\.\/images/g; > > > > Leaning toothpicks! You don't need to escape the '.' on the > > replacement > > string side because they are literal '.' characters there. Changing > > the > > delimiter to something other than '/' will eliminate the need to > > escape > > the '/' characters as well. > > Yes, as I saw in your post. As you say though, if one does not need to > escape the '.'s on the replacement side, because they are literal, > should the '\' not be literal as well?
This should demonstrate what happens: C:\>echo AAAAAAA | perl -pe"s/A/./g" ....... C:\>echo AAAAAAA | perl -pe"s/A/\./g" ....... C:\>echo AAAAAAA | perl -pe"s/A/\\./g" \.\.\.\.\.\.\. As far as "why", it's probably because \. isn't a valid escape sequence so the parser (?) must just turn it into a '.'. Someone with a better understanding of what's going on on the inside can better explain this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>