in reply to postfix incrementing of hash slice
If you just want to autovivify the hash keys without actually assigning any value, you can do that:
[0] Perl> @array = split /\s*/, 'the quick brown fox jumps over the la +zy dog';; [0] Perl> @hash{ @array } =( );; [0] Perl> print sort keys %hash;; a b c d e f g h i j k l m n o p q r s t u v w x y z
You can also do undef @hash{ @list }; which benchmarks very slightly faster.
Whether you think "people will be confused" by either of these is your own call, or that of your employer.
|
|---|