Morrigan wrote:
>
> 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.
#!/usr/bin/perl -w
use strict;
> $count = 0;
> $arraycount = 0;
my $count = 0;
my $arraycount = 0;
my @array;
> while (<DATA>) {
> $line = $_;
> @line_items = split (/\s+/, $line);
@line_items = split;
> $array($arraycount)[0] = $line_items[3];
> $array($arraycount)[1] = $line_items[42];
Use an array of arrays. See perllol for more information.
$array[$arraycount] = [ $line_items[3], $line_items[42], etc...
];
> #etc, assigning some of the junk from input into my
> #special array that i want for sorting later
> ++$count;
> ++$array_count;
> }
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]