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

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

Thread Previous | Thread Next
From:
Dan Book
Date:
March 11, 2021 17:44
Subject:
Re: Perl feature wish: quote-word array-ref operator
Message ID:
CABMkAVVtVMHf4mH2NbQrCSC_5+OL4eUXodHq_aaCpED9WdtLDg@mail.gmail.com
On Thu, Mar 11, 2021 at 3:30 AM Alexander Hartmaier <
alex.hartmaier@gmail.com> wrote:

> What I hate about quoting in Perl in general is that it doesn't allow to
> use the dash! my %hash = ( foo-bar => 'baz' ); doesn't work and needs to be
> quoted.
>

Just FYI this is because Perl identifiers don't consider hyphens to be word
characters (a decision that Raku, as mentioned, has done differently). This
applies to all types of identifiers such as variable and package names,
bareword hash keys are just one place where identifier rules are used:
https://perldoc.perl.org/perldata#Identifier-parsing

-Dan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About