SPUG: Perl new-bee...

Ricardo Cardona ricardo_cardona at hotmail.com
Thu Apr 13 18:28:01 CDT 2000

Hello everyone,

Before you guys chew me out let me say that yes I am a Perl new-bee 
(programmer wanna-be).  I signed up with the Perl Mongers group yesterday in 
order to met up with Perl minded people, pick their brain and expand my own.

Anyway, back to Perl.  I’ve picked up several texts on Perl, everything from 
the O’reilly series books to the yellow cover ‘Perl for dummies’.  I’m 
learning quite a lot and steadily climbing up the learning curve.  I’ve got 
a pet project in mind and I was hoping to get some feed back form you guys 
–and girls.

Here is my pet project;
I’ve got an ASCI file that I what to parse and manipulate at half hour 
increments.  It looks something like this;  I added the > just to separate 
the different sections

>Section 1
START:2000/02/02 00:00:00 WED; STOP: 2000/02/03 00:00:00 THU;
SLOWSAMPLES:       864 ; FASTSAMPLES:       8640 ;

>Section 2
             DREU       PREU        TRU        SBU
              MBU   OUTMTCHF    CONNECT     TANDEM
              AOF        ANF       TOTU     ANSWER
          INVAUTH    BLKCTRK      MAXBU    TRU2WIN

>Section 3
    OG     1     1
                0          0          0          0
                0          0          0          0
                0          0          0          0
              864          0          0          0
                0          0        864          0
                0          0         48          0
                0          0          0
>Section 4
    54 LDEKDD054I7
    2W    72    72
             9378          0         47          0
                0          0          0          0
                0          0      14702          0
                0          0          0       9327
                0          0      14702          0
                0          0       1090      14702
                0          0          0

I get this file every half hour 24/7, the above clip is only the first page 
from this file, and it’s actually about 5000 lines long and contains data 
for about 950 circuits.

     Section 1 is just the header for the file and contains info that is not 
important to me at the moment.
     Section 2 contains the field headers for the following repetitive 
     Section 3 contains the actual data fields for a particular circuit 
(example circuit # ‘54 LDEKDD054I7’ from section 4.)

What I’m looking to do is this;  I trying to figure out a way to parse this 
file and place the data fields into a database/file with the field headers 
from section 2.  From my limited knowledge of Perl I figure that I can place 
this data into an associative array using the circuit ID # as the name of 
the array and the fields headers as the key for that array.  (Ideally I 
would like to create a database table for each of these circuits.  This 
database table would be updated with a new record extracted from each half 
hour file  (something for the future)).    Problem is this, based on what I 
have learned from my reading, I’m not sure how to parse this file and 
extract the data fields and place them into a variable/list/array.  From 
what I’ve read Perl is great at manipulating text files but I don’t have any 
examples of how to do what I’m looking to do.  By the way, the data fields 
are not delimited (although I’m told that I can receive them in a delimited 
format) they are actually a screen dump from a terminal server.

I would like to put these files into this a data base format so that I may 
have a run simple ratio calculations on the different fields.  For instance, 
INFAIL by NATTMPT, in the future I would like to display and change this 
ratio info graphically using a Perl module or Tcl/Tk.

Hey guys I know that you must be busy with your day-to-day stuff but any 
assistance/ guidance/support you can offer will be greatly appreciated.   
Please forward and any comments or help to ricardo_cardona at hotmail.com


Get Your Private, Free Email at http://www.hotmail.com

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace "action" below by subscribe or unsubscribe
           Email to majordomo at pm.org: "action" spug-list your_address

More information about the spug-list mailing list