if ( my $id = $obj->get_id() ) { $obj->do_this(); } elsif ( my $id = $obj->create_id() ) { $obj->do_that(); } else { $obj->do_somethingelse(); }