in reply to Is "ref $date eq 'ARRAY'" wrong?

How about this:
sub normalize_date { my $date_proto = shift; my $stringified = "$date_proto"; # Check to see if it's NOT a reference unless ($stringified =~ /\(0[Xx]\d+\)$/) { return split /\D+/, $date_proto; } # At this point, we know we have a reference of some sort ... # Let's see if it acts as an array ... if ( eval { @{$date_proto}; 1} } ) { # We know we can treat $date_proto as an array return $date_proto; } # At this point, we don't know what to do with $date_proto. # (Well, the OP hasn't spec'ed it out ...) }

The major update here is that it plays nicely with overload. For example, I might have:

package Date::As::Hash; use overload '""' => 'stringify'; # Some stuff here ... sub stringify { my $self = shift; "$self->{MONTH}/$self->{DAY}/$self->{YEAR}"; }

I wish HTML::Template would do something like this ...

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.