{ my $value_of_object_class = \$value1; my $type_of_object_in_use = \$input_type; if ($$type_of_object_in_use eq 'potato') { ## Do stuff with potato } ## do more stuff }