Re: patch: {bonobo,oaf}-slay



On 12/7/01 8:13 AM, "Laszlo PETER" <Laszlo Peter ireland sun com> wrote:

> +if ($ENV{'USER'}) {
> +    $username=$ENV{'USER'};
> +} elsif ($ENV{'LOGNAME'}) {
> +    $username=$ENV{'LOGNAME'};
> +} else {
> +    $username=`logname`;
> +}

The idiomatic perl for this is:

    $username = $ENV{USER} || $ENV{LOGNAME} || `logname`;

I think it's easier to read than the if statement.

    -- Darin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]