in reply to Re: how can this be improved?
in thread how can this be improved?

$recipient = "root" unless (defined($recipient));

Or even shorter with this common idiom:
$recipient ||= "root";

Replies are listed 'Best First'.
Re: Re: Re: how can this be improved?
by dragonchild (Archbishop) on Aug 21, 2001 at 16:08 UTC
    Those are not the same statement. The first only sets $recipient to "root" if $recipient is undef. The second sets it if $recipient is "" or 0, as well.

    One big suggestion I have is to break things out into functions and put those functions in a module. Use that module and your script becomes much smaller. But, that's not the big savings. Say, for instance, you want to do something similar, but not quite the same. You just re-use a bunch of functions and your development time is cut dramatically. In addition, you already know that the funtions in this module are debugged correctly, so you can trust them! :)

    ------
    /me wants to be the brightest bulb in the chandelier!

    Vote paco for President!

      thanks for the suggestion ... I thought of doing it in modules, but because of the way that it will be used, I decided that it would be more robust if it was self-contained. (Perhaps that isn't a good decision; time will tell :-)