Are quotes around hash keys a good practice in Perl?

后端 未结 13 2072
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 06:24

Is it a good idea to quote keys when using a hash in Perl?

I am working on an extremely large legacy Perl code base and trying to adopt a lot of the best practices s

13条回答
  •  时光说笑
    2020-12-03 07:13

    Quoteless hash keys received syntax-level attention from Larry Wall to make sure that there would be no reason for them to be other than best practice. Don't sweat the quotes.

    (Incidentally, quotes on array keys are best practice in PHP, and there can be serious consequences to failing to use them, not to mention tons of E_WARNINGs. Okay in Perl != okay in PHP.)

提交回复
热议问题