in reply to Optional quotes: to use or not to

are you using quotes in such situations?

my $abc = { 'word' => 'abc', 'number' => 123}; $abc->{'otherword'} = 345;
Always for strings, never for numerical values.

why? / pros of your way

Visually distinct from other stuff, syntax highlight treats quoted values differently -> easier to recognize if something looks strange.

cons of your way

It's not necessary to quote everything.

Replies are listed 'Best First'.
Re^2: Optional quotes: to use or not to
by hurricup (Pilgrim) on Jul 10, 2015 at 11:33 UTC

    Visually distinct from other stuff, syntax highlight treats quoted values differently -> easier to recognize if something looks strange.

    Well, this depends on IDE you are using

      Well..
      $example{time} = time;

      Does your IDE get that right? What exactly is 'right'?

        Mine does. Braced time is a string and other time is a sub. And even:

        grep {time} @somearray;
        Understood right and time is a sub.

      I'm returning to this post because the other one's have strayed off. Sorry about that.

      What I originally meant to say is, that I like string values to be shown in exactly the same way wherever they are located. If I use quotes to denote them then this is guaranteed.

      You were asking about a team and that means it's possible the members are using different IDE's / editors. If the coding convention makes it easier to look over one's shoulder and see roughly the same patterns in syntax-highlighted code then that's a win in my book. (It doesn't really matter what the actual colors are, the pattern is important.)