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"]
>
From: "John W. Krahn" <[EMAIL PROTECTED]>
> Jenda Krynicky wrote:
> >
> > Assuming you meant
> >
> > @a=("I","LOVE","PERL");
> >
> > $b = join(' ', map {ucfirst(lc($_))} @a) . "\n";
>
> $b = qq<@{[map"\u\L$_",@a]}\n>; # :-)
($b=lc"@a\n")=~s/\b(.)/\U$1/g;
or
($b="[EMAIL PROTECTED]")
Jenda Krynicky wrote:
>
> Assuming you meant
>
> @a=("I","LOVE","PERL");
>
> $b = join(' ', map {ucfirst(lc($_))} @a) . "\n";
$b = qq<@{[map"\u\L$_",@a]}\n>; # :-)
> print $b;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional comm
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"
In article <[EMAIL PROTECTED]>, Steve Grazzini wrote:
> On Tue, Jul 01, 2003 at 11:40:55AM +0200, Kevin Pfeiffer wrote:
>> I tried a couple more variations - and wonder why the last
>> one doesn't evaluate a count of the slice...
>
> I think this is interesting:
>
>> $string = @array[0..1];
>>
Steve Grazzini wrote:
On Tue, Jul 01, 2003 at 03:43:31PM +0530, Sudarshan Raghavan wrote:
array vs list, an array in a scalar context evaluates to the
number of elements in it. The same does not apply to a list,
infact I don't think there is a list in scalar context.
Yep. "There is no l
On Tue, Jul 01, 2003 at 03:43:31PM +0530, Sudarshan Raghavan wrote:
> array vs list, an array in a scalar context evaluates to the
> number of elements in it. The same does not apply to a list,
> infact I don't think there is a list in scalar context.
Yep. "There is no list... "
> my $string =
Yeah, thanx, I figure this one out after I realize the
opposite of split is join...how stupid was I not
recognizing that!
--- PANNEER SELVAN <[EMAIL PROTECTED]>
wrote:
> Is this okay?
>
> @a=("I","LOVE","PERL");
> $i=join(" ",@a);
> print $i;
>
>
> - Original Message -
> From: "Ling F.
On Tue, Jul 01, 2003 at 11:40:55AM +0200, Kevin Pfeiffer wrote:
> I tried a couple more variations - and wonder why the last
> one doesn't evaluate a count of the slice...
I think this is interesting:
> $string = @array[0..1];
> print "$string\n";
> # prints "oranges" (why not "2"?)
Do you exp
Kevin Pfeiffer wrote:
In article <[EMAIL PROTECTED]>, Sudarshan Raghavan
wrote:
Ling F. Zhang wrote:
say I have array:
@a=["I","LOVE","PERL"]
[...]
This will do what you want
my $arr_to_str = "@a";
[...]
Wow!
I tried a couple more variations - and wonder why the last
In article <[EMAIL PROTECTED]>, Sudarshan Raghavan
wrote:
> Ling F. Zhang wrote:
>
>>say I have array:
>>@a=["I","LOVE","PERL"]
[...]
> This will do what you want
> my $arr_to_str = "@a";
[...]
Wow!
I tried a couple more variations - and wonder why the last one doesn't
evaluate a count of the
Ling F. Zhang wrote:
say I have array:
@a=["I","LOVE","PERL"]
You have created a reference to an anonymous array here, I guess you meant
@a = qw/I LOVE PERL/;
I would like to make a scalar:
$b="I Love Perl\n"
Please don't name variables as $b etc, they make the code unreadable and
read through
Is this okay?
@a=("I","LOVE","PERL");
$i=join(" ",@a);
print $i;
- Original Message -
From: "Ling F. Zhang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 01, 2003 4:56 PM
Subject: combining array to scalar
> say I have array:
> @a=["I","LOVE","PERL"]
> I would like t
13 matches
Mail list logo