Hello friends .....I am stuck at one question in perl....I have wrote a subroutine which is called by someother subroutine.....The task of this subroutine is to insert value in database.The sub routine is as follows:

sub _get_user_scenario { my ($self, $schema, $user_scenario) = @_; my $user_scenario_rs = undef; eval { #get the number of user scenarios in the database table my $count = $schema->resultset("UserScenario")->count(); #insert user scenario, or if already in database, update the descripti +on $user_scenario_rs = $schema->resultset("UserScenario")->update_or_create( { name => $user_scenario->{name}, description => $user_scenario->{description}, }, { key => "u_user_scenario_name" }, ) || die "Unable to update/insert data to table UserScenar +io: $!\n"; }; if($@) { #warn(); $self->log_writer()->write_error_row("Unable to get/insert dat +a to table UserScenario: $@"); return undef; } else { return $user_scenario_rs; } }

If $user_scenario->{description} is empty then I don't want to replace the description for the existing sceanrio.And I wanna keep the value which is already there in the database for that scenario.How to achieve it?Any suggestions? Thanks in advance!!!!


In reply to how to get out of subroutine without returning anything by siddheshsawant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.