Says nobody in particular:
unless($list_info{subscribed_message} ne "" || exists $list_info{subscribed_message}) { $list_info{subscribed_message} = $subscribed_message }

The first thing I notice here is that your test is redundant. If x ne "" is true, then exists x must also be true. (Or equivalently, if exists $h{k} is not true, then k is not in the hash, so $h{k} must be equal to "".) So you should rewrite this as:

if ($list_info{subscribed_message} eq "") { $list_info{subscribed_message} = $subscribed_message; }
which is something of an improvement already.

Now, perhaps this would be a good place to use a mutator subroutine?

sub set_if_not_set_already { $_[0] = $_[1] if $_[0] eq ""; } set_if_not_set_already($list_info{subscribed_message}, $subscribed_message);
Or you could abbreviate a little futher and get rid of the mutator:
sub initialize_list_info { $list_info{$_[0]} = $_[1] if list_info{$_[0]} eq ""; } initialize_list_info('subscribed_message', $subscribed_message);
This is neither a recommendation nor a disrecommendation. Just something to consider.


In reply to Re: Error in Camel Book Ver2? by Dominus
in thread Error in Camel Book Ver2? by Anonymous Monk

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.