Keep It Simple, Stupid | |
PerlMonks |
Re^3: Test Number of Elements In Arrayby liverpole (Monsignor) |
on Jun 07, 2009 at 15:45 UTC ( [id://769284]=note: print w/replies, xml ) | Need Help?? |
"The downsite is having "magic" numbers in your source code."
One doesn't introduce any new "magic numbers", if instead of writing:
One writes:
"And the trick only works when comparing against a literal, not a variable." Granted. But that doesn't make it any less useful to use for constants, which was my point. Speaking of magic numbers, I think one can get too carried away with their usage. I would argue the following goes a bit overboard ...
The above example is based on a college classmate of mine who, back in the days of BASIC, had the constant "dpy" ("Days per year") in a startup script, so when he needed it, he could type "dpy" instead of "365"! s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
In Section
Seekers of Perl Wisdom
|
|