in reply to Re: (FoxUni) Re: Explanation of complicated line?
in thread Explanation of complicated line?

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";

Replies are listed 'Best First'.
Re(3): Explanation of complicated line?
by FoxtrotUniform (Prior) on Apr 02, 2002 at 21:36 UTC

    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++.