Re: patch: {bonobo,oaf}-slay
- From: Darin Adler <darin bentspoon com>
- To: <Laca ireland sun com>
- Cc: Gnome Components <gnome-components-list gnome org>
- Subject: Re: patch: {bonobo,oaf}-slay
- Date: Fri, 07 Dec 2001 09:43:09 -0800
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]