Jenda Krynicky wrote: > Date sent: Tue, 1 Jul 2003 00:56:10 -0700 (PDT) > From: "Ling F. Zhang" <[EMAIL PROTECTED]> > Send reply to: [EMAIL PROTECTED] > Subject: combining array to scalar > To: [EMAIL PROTECTED] > > > say I have array: > > @a=["I","LOVE","PERL"] > > I would like to make a scalar: > > $b="I Love Perl\n" > > > > can I do this with a simple one-liner? > > Assuming you meant > > @a=("I","LOVE","PERL"); > > $b = join(' ', map {ucfirst(lc($_))} @a) . "\n"; > print $b;
FWIW there's no need for the explicit parameter to 'lc' or the parentheses: $b = join ' ', map {ucfirst lc} @a; Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]