in reply to Is a Dispatch Table appropriate here?

Since your first line really wants a boolean, I would have changed your first line to something like:

$send_flag = ($bbstatus ne $last_bbstatus) or (($now - $last_send_time) > $min_frequency) or defined($OPTS::opts{f});

If you're really looking for a dispatch table you could do something like:

my @messages = ( [ sub { $bbstatus ne $last_bbstatus }, "Status not changed" ], [ sub { ($now - $last_send_time) > $min_frequency }, "Last send too +old" ], [ sub { defined($OPTS::optf{f}) }, "Forced send requested" ], [ sub { 1 }, "No changes" ], ); foreach my $m (@messages) { print $m->[1], last if $m->[0]->(); }

Note: the above is completely untested.

Update: I thought of another way of implementing this while in the shower. It does avoid the dispatch table, and it does set the correct variables based on the booleans. Still, it may not be easy to read for newer Perl developers.

my $send_message = ($bbstatus ne $last_bbstatus and "Status no changed") or (($now - $last_send_time) > $min_frequency and "Last send too o +ld") or (defined($OPTS::opts{f}) and "Forced send requested") or "No changes"; my $send_flag = $send_message ne "No changes";