develooper Front page | perl.perl5.porters | Postings from March 2021

Re: Perl feature wish: quote-word array-ref operator

Thread Previous | Thread Next
Martijn Lievaart
March 10, 2021 17:55
Re: Perl feature wish: quote-word array-ref operator
Message ID:

Op 10-03-2021 om 17:12 schreef Felipe Gasper:
>> On Mar 10, 2021, at 3:09 AM, Smylers <> wrote:
>> Felipe Gasper writes:
>>> Perl, for better or for worse, suffers a reputation as being hard to
>>> read. In that light, I do think special care is justified when adding
>>> additional ways to do everyday tasks like creating an array reference.
>> As Eirik said, I think this makes code _easier_ to read. Less
>> distracting clutter of multiple nested brackets, or trying to work out
>> what each do.
> As I wrote earlier, there are wins and losses. Less syntax is a readability win, but having multiple ways to do familiar things is a loss. For example, if I write:
> my $foo = [ 1, 2, 3 ];
> my %bar = (
>      abc => qa/a b c/,
>      def => qa/d e f/,
> );
> my @baz = qw/ ha ha ha /;
> … then someone has to grok both syntaxes for arrayref-literal creation, as well as qw, in order to comprehend the code.


I am an oldtimer, but the code above reads as a win for me. Extremely 
easy to grok.


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