What's a better way to validate an array ref than "if( 'ARRAY' eq ref $foo )"? Thanks!
There are caveats whichever way you do it, but currently I tend to default to just derefing it within an eval block:
if (eval{ use strict 'refs'; @$foo; 1 }) { # it is, or pretends convincingly, to be an array ref }
Caveat? Right. In the presence of ties or overloading, there may be side effects to derefing it. Pick your poison / buyer beware / etc.
print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!
In reply to Re^3: RFC: Perl meta programming
by Sidhekin
in thread RFC: Perl meta programming
by bennymack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |