in reply to Quoting hash keys

> Is there a difference between $hash{ key } and $hash{'key'}?

no, but there is an opposite issue if key is a sub or a constant .

you'll need $hash{ key() } or $hash{ (key) } then.

not really a problem for me, YMMV.

> I always quote it unless the key is non-constant.

I don't understand.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: Quoting hash keys
by Bod (Parson) on Nov 10, 2021 at 01:16 UTC
    > I always quote it unless the key is non-constant. I don't understand.

    Sorry for the ambiguity.

    By non-constant I mean anything that is either a variable or intopolates a variable. Such as $var or qq[st_$id]