It would also work if you wrote it like this:

$count = 0;
$arraycount = 0;
while (<DATA>)  {
        $line = $_;
        @line_items = split (/\s+/, $line);
        ${'array'.$arraycount}[0] = $line_items[3];
        ${'array'.$arraycount}[1] = $line_items[42];
        ++$count;
        ++$arraycount;
}

or this:

$count =0;
$arraycount = 0;

while(<DATA>){
        @line_items = split /\s+/;  #$_ is assumed
        push @{'array'.$arraycount},$line_items[3];
        push @{'array'.$arraycount},$line_items[42];
        ++count;
        ++arraycount;
}

-----Original Message-----
From: Morrigan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 1:08 PM
To: [EMAIL PROTECTED]
Subject: Can you have a function automatically make a set of numbered
arrays? 


I am trying to write a function which creates a set of
numbered arrays for me (@array1, @array2, @array3 . .
 @arrayn) so I can keep some of the input from a file
I am reading in.  I'm not sure if it's possible in the
first place, or, if so, if my syntax is anywhere close
to correct.  This is the code I have tried.  It gives
me syntax errors about the last few lines and won't
run.  I would appreciate any help or being pointed
towards books which address this.  Please excuse me if
it is a stupid question.  I am just starting.

Thanks.
-morrigan

$count = 0;
$arraycount = 0;
while (<DATA>)  {
        $line = $_;
        @line_items = split (/\s+/, $line);
        $array($arraycount)[0] = $line_items[3];
        $array($arraycount)[1] = $line_items[42];
#etc, assigning some of the junk from input into my 
#special array that i want for sorting later
        ++$count;
        ++$array_count;
                }



__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to