in reply to Re: Explanation of complicated line?
in thread Explanation of complicated line?

That's the solution I was looking for.... I thought it was some complicated substitution that depended upon the '\' character for something...but surely enough, just a typo. Things are peachy now! Much thanks...
  • Comment on Re: (FoxUni) Re: Explanation of complicated line?

Replies are listed 'Best First'.
Re^2: (FoxUni) Re: Explanation of complicated line?
by tadman (Prior) on Apr 02, 2002 at 21:25 UTC
    Looks like a bad habit developed by a bash programmer, as bash gets really upset if you don't "literal" your newlines . The backslash means, roughly, "continued on next line".

    Perl, fortunately, understands what you mean when you split lines for readabilty. You can even split your quotes, such as:
    my $foo = "This Is Rather Poetic";
    Which, for comparison, is not so easy in something like C:
    char *foo = "This\ Is\ Rather\ Tedious";

      Um, no. At least on gcc 2.9.3:

      char* foo = "This\ is\ rather\ tedious";

      produces the string "Thisisrathertedious", and:

      char* foo = "This is rather poetic";

      produces what you're getting from your Perl example.

      Don't knock C for the wrong reasons.

      --
      :wq

        I'm sure it's a historical artifact more than a requirement, especially considering how some improvements made to C++ are trickling back into C (i.e. '//'-style comments) if only because of popular demand. The "correct" C example, using backslashes, is reasonably:
        char *foo = "This\n\ Is\n\ Rather\n\ Tedious";
        I suppose that earlier and/or less robust C compilers would not comprehend the concept of a string being continued onto a second line.

        I'm sorry if you mistook my unfortunate "ignorance" as being anti-C. I meant nothing of the sort. I'm rather a fan of C++.