# ... DBI stuff ... grab row with binary datatype $parent_hex = '0x0' . unpack("H*",$row->{parentid}); #### if ( !$parent_hex ) { #do something } else { #do something different }