Perfect thanks!

-----Original Message-----
From: Kipp, James [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 30, 2003 10:28 AM
To: '[EMAIL PROTECTED]'; Perl
Subject: RE: Data Structure


>The problem is I can
> figure out
> what data structure to build. It would need to contain the year, the
> item code description sales and qty I thought I would name the
> structures after the vendor. So all BAUE00 would be in one structure. 
> 
> I am just learning how to build anything beyond an array of
> arrays or an
> array of hashes.
> I can complete this job without any help but I thought this would be a
> good exercise on data structures. Any suggestions would be deeply
> appreciated.
> 
> I am reading it like this to start.
> while (<IN>){
>       chomp;
>       @temp = split /\|/,$_;
>       $_=~s/\s+$//g foreach (@temp);

Hi Paul
So you have a simple pipe delimted file. I don't think you need much
more than an MD array. Here is what you can do (note I left out the
regex stuff):

while (<IN>) {
        #chomp;
      # push each line of data onto the array using a ref 
        push (@data, [ split(/\|/,$_) ] );
}

# just to show what is in the matrix now
for $row (@data) {
        print @$row;
---

from here you can parse it out into insert into your excel file. like
row1
-> col2.
Is this what you were looking for. Let me know if you need help parsing
out the elements of the data structure to insert into excel

HTH,
Jim





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

Reply via email to