On Fri, 18 Jun 2004 09:30:56 EDT, <[EMAIL PROTECTED]> wrote:

Greetings,

As a learning Perl Person, this is fun. Would someone please point me in the
correct direction to read a comma delimited file and put it into an array?
The fields are always in the same position, blank fields will have a comma.
My sample is:


header10,header11,,header13
header20,header21,header22,header23
header30,,header32,header33


I then need to format this data and an array looks like the easiest way of
doing this.


Many thanks,

Richard Hug


Use the split function. Look up 'perldoc -f split ' to know more about the function.

To get started, try this,

open(FH,"File.dat") or die "Cannot open filed #!\n";

while(<FH>) {
        my @array = split(/,/,$_);
        # do something with the array
}


Raj


-- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to