in reply to Quote and Quote-like Operators
I agree with the other comment that heredocs are not ugly, and are often the best way of including multi-line strings in your code (such as big chunks of SQL).
It might be worth mentioning how heredocs can be stacked:
use Test::More; use Example::HTML::Reformatter qw/reformat/; is(reformat(<<'IN'), <<'OUT', 'HTML was reformatted'); <html><head ><title>Foo</title><body></html> IN <html> <head> <title>Foo</title> </head> <body> </body> </html> OUT done_testing(1);
Another thing worth mentioning might be how when bracketting characters are used to quote strings, they must balance.
my $str = q{Foo{the following curly does not end the quote}but the nex +t one does};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Quote and Quote-like Operators
by Xiong (Hermit) on Dec 16, 2011 at 11:58 UTC | |
by tobyink (Canon) on Dec 16, 2011 at 18:01 UTC | |
|
Re^2: Quote and Quote-like Operators
by JavaFan (Canon) on Dec 16, 2011 at 13:41 UTC | |
by choroba (Cardinal) on Dec 16, 2011 at 13:51 UTC |