On Monday, 27 December 2021, 19:43:02 CET, Felipe Gasper <felipe@felipegasper.com> wrote: > IMO a “stricter” mode that refuses to do “nonsensical” things like numeric operations on > non- numeric SVs, scalar ops on references, etc. would be one of the most helpful features > Perl could add. (Magic notwithstanding, of course.) > > We all know Perl “happily confuses” numbers and numeric strings, but other cases seem like > places where the language could (fairly?) readily assist with bug-hunting. > > Is there a list anywhere of such behaviours? Another example is JSON: {value:"0"} If someone sends something as a string and I'm expecting a number, I can only guess if "0" is supposed to be the string "0", the number zero, or "false". Most of the time the Perl code does the right thing, until it doesn't. And that can cause weird error far away from where the parsing occurs. (Yes, I'm aware of the new booleans for Perl: https://www.nntp.perl.org/group/perl.perl5.porters/2021/11/msg261993.html) Best, Ovid -- IT consulting, training, specializing in Perl, databases, and agile development http://www.allaroundtheworld.fr/. Buy my book! - http://bit.ly/beginning_perlThread Previous | Thread Next