use Struct::Compare; print "same" if compare( $ref1, $ref2 );