in reply to Re: Remove the ^M Character from a Document
in thread Remove the ^M Character from a Document

The use of the forward slash to delimited regular expressions and replacements has a history of decades - predating the birth of Perl by years. There are no forward slashes in the regular expression that could cause confusion. So, other than a fear of forward slashes, what makes you think use of a forward slash contributes to obfuscation?

Abigail

  • Comment on Re: Remove the ^M Character from a Document

Replies are listed 'Best First'.
Re: Re: Remove the ^M Character from a Document
by Sifmole (Chaplain) on Jun 03, 2002 at 18:01 UTC
    Perhaps hacker actually means that the use of another character could make things easier to read. I remember somewhere some book or other refering to the "leaning toothpick" problem.
      The leaning toothpick syndrome arises if one has to escape forward slashes. No forward slashes need to be escaped.

      Pray tell us, why are comma's or hashes easier to read than forward slashes, especially considering that forward slashes are most commenly used as delimiters, while commas and hashes usually play another role?

      Abigail

        As you know, "LTS" or "Leaning Toothpick Syndrome" does not always have to involve the use of the '\' character to escape the presence of another '/' character. Seeing '/\/\/\' is also an example of LTS.

        Using another delimiter makes the code more readable, and is recommended by many top perl programmers (and is also covered in perlfaq, perlretut and in japhy's book).

        They are easier to read, because I don't have to visually and mentally separate what the content between the substitution means before I can decipher what the substituion does.

        Are we not here to teach others, and share that knowledge we've learned with others who may not yet have the experience?

        TMTOWTDI

        Maybe the poster has a pathlogical issue with slashes, maybe commas are like prozac to them. Perhaps they were viciously harrangued by a maruading horde of forward slashes on their way to kindergarten one day.

        Seriously though, I didn't say it was easier to read but that perhaps that was what the poster was getting at.