Subject: cperl-mode: Commit d0ad6306 suppresses fontification of hash/array declarations

From: Harald Jörg <[email-masked]>
Date: Tue, 1 Sep 2020 18:02:18 +0200

The recent fix d0ad6306 to cperl-mode fixes a lot of unwanted
fontification of arrays and hashes, in particular in comments, POD,
and strings.  However, as a side effect it also prevents fontification
in a variable declaration (this has been observed by choroba):

   my @arr = (1,2,3); # @arr fontified as a scalar - bad
   push @arr, 4;      # @arr fontified as an array - good
   print $arr[4];     # $arr fontified as an array - good

   my %hash = ( foo => 'bar' ); # %hash fontified as a scalar - bad
   $hash{baz => 'quux'};        # $hash fontified as a hash - good

Can this be easily fixed?

---

Of minor importance: There are some cases where fontification of an
array in a string makes sense, but is gone now:

   my $mail = "[email-masked]";

This was previously fontified as an array.  This makes sense because
in doubly-quoted strings, the value of arrays (here: @somewhere) will
be interpolated into the string.  In the example above, the
fontification of @somewhere as an array was a welcome warning that
this is not what you want.

Fontification of a hash in a string, on the other hand, never makes
sense because hashes aren't interpolated.

---

Also, this bug can be merged with (Bug#11054), which in turn had been
merged with (Bug#3091).