in reply to Correct keys in hashes
The unquoted strings (a.k.a. "bareword strings") are ambiguous. If, for some strange reason, the Perl interpreter decides to interpret name as a function or somesuch, there could be logic bugs. So, some consider it good practice merely to quote all bareword strings (hash keys included) simply to promote readability and "take no risks".
The fact of the matter is, though, that the likelihood of a bareword being confusing to the interpreter and not generating a warning or error -- even in future Perl releases -- is fantastically small. So, don't worry about it!
In any case, just pick one and be consistent. If you think quoted strings are better in place of barewords, go ahead and use them -- just use them in every case. Consistency makes for far more readable (and maintainable) code than adherance to anyone else's ideas of "right code".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Correct keys in hashes
by Aristotle (Chancellor) on Aug 25, 2004 at 20:25 UTC | |
by radiantmatrix (Parson) on Sep 07, 2004 at 19:01 UTC |