in reply to Re: if (ref $value eq "ARRAY") {
in thread if (ref $value eq "ARRAY") {

I think some weakly-typed languages do better. To reflect back on the big thread from the other day that all languages evolve toward Lisp, Common Lisp allows for "overloading" functions based on type or arbitrary tests. So, one could separate things out into broad different things, but still be flexible within each thing.

I guess that's just syntactic sugar around the test I could write inside the function, now.

I think the concept here is that "all differences in allowed parameter types should be done through polymorphism". In Perl, that's hard to do with anything that's not blessed.

But, it does suggest something. I could have an abstract base class to serve as an "interface", and recognise that case as well as the built-in things (plain scalar and array ref). Then, anyone wanting to pass an object and have it mean something to this function would simply need to make it "isa" that interface class.

— John