in reply to Better heredocs?
I don't really mind the end marker doesn't match up with the code that follows, I'd rather see where does the string literal end and normal Perl code starts. What I would definitely not like to have to do is to update the s/^\s{...}//gm if I indent the code some more. Plus I'd generally like to indent the text one level more than the assignment. Which means that if I did care enough I'd probably use something as:
sub foo { if (1) { unIndent(my $content= <<'*END*'); foo bar baz <html> <body> </body> </html> *END* print $content; } } foo(); sub unIndent { my ($indent) = ($_[0] =~ /^([ \t]+)/); $_[0] =~ s/^$indent//gm; }
|
|---|