You can use ref to figure out the type of a reference/object. In your case, it seems you don't want to print it if it's "SCALAR"; or maybe the other way round, you do want to print it if it's "HTML::ElementTable::DataElement".
if ( ref($row->[7]) eq "HTML::ElementTable::DataElement" ) { print $row->[7]->as_text; }
Update: a more generic way would be to use can() to directly test whether the method in question is available:
use Scalar::Util 'blessed'; if ( blessed($row->[7]) and $row->[7]->can("as_text") ) { print $row->[7]->as_text; }
can() can only be called on blessed references, though, so you'd need to use Scalar::Util... (unless you resort to ugly stuff like if ("$ref"=~/=/ and ...) ).
In reply to Re^5: How to check if an array element reference exists or not
by almut
in thread How to check if an array element reference exists or not
by corpx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |