Rob Dixon wrote:
> Dr.Ruud wrote:
>>
>> Karyn Williams schreef:
>>
>>> $initial ?
>>> $gecos = "$first $initial $last, $sid, SIR Fall 2007":
>>> $gecos = "$first $last, $sid, SIR Fall 2007";
>>
>> Variant-1:
>>
>> $gecos = $first;
>> $gecos .= " $initial" if $initial;
>> $gecos .= " $last, $sid, SIR Fall 2007";
>>
>>
>> Variant-2:
>>
>> $gecos = $first
>> . ($inital ? " $initial" : "")
>> . " $last, $sid, SIR Fall 2007";
>
> $gecos = do {
> my @name = grep $_, $first, $initial, $last;
> "@name, $sid, SIR Fall 2007";
> };
my $gecos = join ' ', $first, $initial || (), "$last, $sid, SIR Fall 2007";
( my $gecos = join ' ', $first, $initial, "$last, $sid, SIR Fall 2007" ) =~
tr/ //s;
my $gecos = $first . ( $initial ? ' ' : '' ) . "$initial $last, $sid, SIR Fall
2007";
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/