in reply to How can I read a line of text from a file into an array?
Try using some of the code below. A note of caution is that using map will create a 2d array. If you only have one line in the file they will all apear in the 0th element of the first dimension of the array. I hope this helps.
Donesh
Code:
sub getdata { my $filename = "<" . shift; open (HANDLE,$filename) or die "Cant Open $filename: $!"; my @final = map{chomp; [split/,/]} <HANDLE>; close HANDLE; return (@final); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How can I read a line of text from a file into an array?
by dvergin (Monsignor) on Jul 16, 2001 at 22:41 UTC |