develooper Front page | perl.perl5.porters | Postings from July 2016

Re: Indented here docs?

Thread Previous | Thread Next
Alberto Simões
July 1, 2016 11:09
Re: Indented here docs?
Message ID:

On 01/07/16 12:03, H.Merijn Brand wrote:
> On Fri, 1 Jul 2016 10:38:28 +0000 (UTC), Ed Avis <>
> wrote:
>> If this is added, there need to be checks that the indentation is consistent
>> through the heredoc.  So for example this would not be allowed:
>>     $foo = <<~END;
>>     hello
>>   there
>>     END
>> Error at line 3: leading indentation on line is less than the indentation of
>> the end delimiter.
>> At least, I would prefer that.  This restriction could be relaxed later if it
>> turns out to get in the way, but it would be hard to add it if it weren't
>> there originally, so I suggest it's safer to include the restriction in the
>> first version of this new feature.
> And what about - oh horror - mixed tabs and spaces?
> Should it auto-expand leading whitespace?
> <TAB><SPACE> is just three characters, <SPACE>{9} is nine characters.
> Would you see the difference in
>     my $foo = <<~"EOM";
> 	 First line
>          Second line
>   	 EOM
>     my $bar = $foo;
> Looks (visually) correct, right? But it is three different leading space

Let it work only if the prefix is the same, exactly the same order of 
tab and spaces?

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About