devbond has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to read a file and split(by space) into an array called values and finally puttin it into a array table.I am able to do it for a single file but i want to split 8 files in a loop one after the other into 8 different arrays..table1 table2....table 8.
But the following code below is not working. Please advise.
for (my $i = 1 ;$i <=8; $i++) { open (MYFILE,"server$i"); while (<MYFILE>) { chomp; my @values = split " ",$_; push @{ "table$i"},\@values; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Splitting Multiple files into arrays.
by rjt (Curate) on Jul 20, 2013 at 21:24 UTC | |
by devbond (Novice) on Jul 21, 2013 at 11:07 UTC | |
by rjt (Curate) on Jul 21, 2013 at 20:47 UTC | |
Re: Splitting Multiple files into arrays.
by jwkrahn (Abbot) on Jul 20, 2013 at 21:49 UTC | |
Re: Splitting Multiple files into arrays.
by Laurent_R (Canon) on Jul 20, 2013 at 23:03 UTC | |
Re: Splitting Multiple files into arrays.
by mtmcc (Hermit) on Jul 20, 2013 at 21:50 UTC | |
Re: Splitting Multiple files into arrays.
by mtmcc (Hermit) on Jul 20, 2013 at 20:55 UTC | |
by devbond (Novice) on Jul 21, 2013 at 10:24 UTC |
Back to
Seekers of Perl Wisdom