>>>>> "JD" == John Delacour <johndelac...@gmail.com> writes:
JD> At 13:00 -0500 04/02/2011, Uri Guttman wrote: HP> Yet they seem to be carefully avoided. That is what I nearly always HP> use. Is there some reason to avoid `//' as delimiters? JD> [ I really object to the backtick being used instead of an opening JD> quote mark. The only possiblt excuse for it is if plain text needs JD> eventually to be converted quickly to text containing curly quotes. ] >> >> no. you should // in most cases. you should change to alternate >> delimiters (for all delimited string like things) when the default >> delimiter is in the string itself... JD> I think it's misleading, and certainly inaccurate, to say you _should_ JD> use the solidus (the correct name for the character you colloquially JD> call a slash) in preference to any other delimiter in matches and JD> substitutions. I personally almost always use the tilde as in m~x~, JD> s~x~y, qq~string~, not only because it rarely occurs in the patterns JD> or the strings but also because I find it less likely to be confusing. JD> Others use different delimiters with just as much right or reason. As JD> you yourself say the solidus can become very confusing as a delimiter JD> because not only the solidus itself within a pattern needs to be JD> escaped with a reverse solidus but so may other characters, with the JD> risk of an unreadable string of leaning toothpicks. it isn't misleading. you use default delimiters because they are the ones you look for normally. using alternate delims tells the READER (not yourself), that there is likely to be a standard delimiter inside the string so look for it. JD> In brief people are free to use what they like. TMTOWTDI. taking your idea to the max, why not write with single letter var names all the time? not all ways are good ways. just because you can do odd things legally doesn't make it good code. here are some coding rules to think about: code is for people, not computers. code is for OTHER people, not yourself. you write code so other people can understand your intentions. if you mislead them with alternate delimiters when they are not needed, they will waste time looking for the normal delims in the string. therefor you are telling the reader misinformation. that is not cool coding no matter what you may think is legal or nice. this comes from 35 years of coding and 18 years of perl. it isn't something i just came up with last week and it is also a common convention thing in perl so it is best to stick with that style. there are plenty of conventions in perl coding and using // for regexes without / inside is normal and expected. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/