Ahhh.. Ok. I see the mistake. I've purchased Oreilly's "Learning Perl"
3rd Edition and have been steadily plugging through it. There is an
example on page 45 which shows another way to populate an array. Here
is one such example they give.
@numbers = 1..1e5;
So basically if you didn't want
On 12/25/2003 12:18 PM, u235sentinel wrote:
But wouldn't the original initilization also work?
@array1[0..5] = 1;
No. Think of this in terms of parallel assignment, ignoring for the
moment that we are talking of arrays, the above is equivalent to:
($e0, $e1, $e2, $e3, $e4, $e5) = 1;
which is e
nts as a group.
Randy.
- Original Message -
From: Randy W. Sims
To: Duong Nguyen
Cc: [EMAIL PROTECTED]
Sent: Thursday, December 25, 2003 3:02 AM
Subject: Re: Perl Help: Array Manipulation
On 12/25/2003 2:51 AM, Duong Nguyen wrote:
> From: Randy W. Sims
Understood. I guess I was trying to show him ( the senec route) that
basically no running total was being compiled. Also that wasn't
the total. I guess it was too late at night for a simple response from
me :-)
Charles K. Clarkson wrote:
u235sentinel <[EMAIL PROTECTED]> wrote:
[snippe
u235sentinel wrote:
> I'm a newbie to perl also. Been workign with it for a whole 2 weeks
> now. Actually.. make that 3 ::grinz::
>
> Warning.. lengthy email below.. I beg forgiveness in advance :-)
Length isn't a problem. There are some problems here, though, because you
are not addressing th
But wouldn't the original initilization also work?
@array1[0..5] = 1;
This seemed to populate the array just fine.
Randy W. Sims wrote:
On 12/25/2003 2:51 AM, Duong Nguyen wrote:
From: Randy W. Sims
>
On 12/25/2003 12:59 AM, Duong Nguyen wrote:
> Hello everyone,
> > Sorry for the
Duong Nguyen wrote:
>
> Hello everyone,
Hello,
> Sorry for the spam,
Why do you think that this is spam?
> I am new to Perl and am having a hard time manipulating
> arrays. Below is the sample code that I am working on:
You should have warnings and strictures enabled while you are developing
u235sentinel <[EMAIL PROTECTED]> wrote:
[snipped valiant attempt]
:
: So now you see on the left the sum of each container in the array.
:
: Ok.. I await the flogging. Someone is bound to have done a better job
: explaining this. At least I can blame it on being up after
: midnight ;-)
Duong Nguyen <[EMAIL PROTECTED]> wrote:
:
: Thanks for the response. I discovered that it was my
: @array1[0..5] =1; initialization.
: So I manually allocated values to the array to see if it
: would work, much to my surprise, the correct "total" was
: being printed. Here's what I did:
:
: c
On 12/25/2003 2:51 AM, Duong Nguyen wrote:
From: Randy W. Sims
>
On 12/25/2003 12:59 AM, Duong Nguyen wrote:
> Hello everyone,
>
> Sorry for the spam, I am new to Perl and am having a hard time manipulating arrays. Below is the sample code that I am working on:
>
> @array1[0..5]
@array1[0] = 1;
@array1[1] = 1;
@array1[2] = 1;
This works well.
- Original Message -
From: u235sentinel
To: Duong Nguyen ; [EMAIL PROTECTED]
Sent: Thursday, December 25, 2003 2:40 AM
Subject: Re: Perl Help: Array Manipul
On 12/25/2003 12:59 AM, Duong Nguyen wrote:
Hello everyone,
Sorry for the spam, I am new to Perl and am having a hard time manipulating arrays. Below is the sample code that I am working on:
@array1[0..5] = 1;
@total[0] = 0;
for($i=0; $i<4; $i++)
{
if($i == 0)
{
@total[$i] =
I'm a newbie to perl also. Been workign with it for a whole 2 weeks
now. Actually.. make that 3 ::grinz::
Warning.. lengthy email below.. I beg forgiveness in advance :-)
Ok. Here is what I did.
#!/usr/bin/perl
@array1[0..5] = 1;
@total[0] = 0;
for($i=0; $i<4; $i++)
{
if($i == 0)
{
Hello everyone,
Sorry for the spam, I am new to Perl and am having a hard time manipulating arrays.
Below is the sample code that I am working on:
@array1[0..5] = 1;
@total[0] = 0;
for($i=0; $i<4; $i++)
{
if($i == 0)
{
@total[$i] = @array1[$i];
print @total[$i];
14 matches
Mail list logo