Hello
I am discussing on module-authors@perl.org about a module I would like to put on CPAN.
A proposal was made to improve the interface of the module; the suggested patch was to add a piece of code like this:
$date = ref $date eq 'ARRAY' ? $date : [ split(/\D+/, $date) ];But another one said:
Never use the value of ref() except in a true/false test.
The correct way to tell if something is an array ref is
ref $date && UNIVERSAL::isa($date, 'ARRAY')
Do you agree? And why?
Ciao!
--bronto
The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz
In reply to Is "ref $date eq 'ARRAY'" wrong? by bronto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |