Cool. I took a little time to look over my Advance Perl Programming Book (the O'Reilly Panther book). I got it working for the most part. However, it appears that I'm having array errors.

To create a list of hospital staff, my method parse through the staff list and records their first and last name into an array. This array is then reference in a hash, using their role (X-ray Tech, physician, Nurse) as a key.

foreach $workerbee($doc->getElementsByTagName('CathStaff')) { print "Staff = $s1, $s2\n"; $s1 = $workerbee->getElementsByTagName('LastName')->item(0 +)->getFirstChild->getNodeValue; $s2 = $workerbee->getElementsByTagName('FirstName')->item( +0)->getFirstChild->getNodeValue; $s3 = $workerbee->getAttribute('Role'); @staff = ($s1,$s2); print "Staff = $s1, $s2\n"; my $arrayref = \@staff; $staff_set{$s3} = $arrayref; }

Now my main loop is this:

!/usr/bin/perl -w use XML::DOM; use CathRecord; ### Create New Object my $file = "H:/My Documents/files/mfrTESTa.XML"; my $obj = CathRecord->new(); my $ref = CathRecord::CamPatData($obj,$file); print"\n"; my $hashref = $ref->{STAFF}; foreach my $inst(keys %$hashref) { my $aih = $$hashref{$inst}; print "$inst: @$aih\n"; }

I get this is a result:

Staff = Joicelan, Rob Staff = Zdoctor, test Staff = Zdoctor, test Staff = Smith, Fred Staff = Smith, Fred Staff = Jones, Bill Staff = Jones, Bill Staff = Nelson, Jim Staff = Nelson, Jim Staff = Fellowlast, Fellowfirst Staff = Fellowlast, Fellowfirst Staff = fellowsecond, fred Staff = fellowsecond, fred Staff = rusoo123456789012, mike56789012345 Circ: rusoo123456789012 mike56789012345 Recording: rusoo123456789012 mike56789012345 Fellow: rusoo123456789012 mike56789012345 Scrub: rusoo123456789012 mike56789012345 Assisting_MD: rusoo123456789012 mike56789012345 Other: rusoo123456789012 mike56789012345 Rad: rusoo123456789012 mike56789012345 Physician: rusoo123456789012 mike56789012345

So what's up with that?


In reply to Re^2: Attempting to read file name into my XML Parsing Object by Cappadonna3030
in thread Attempting to read file name into my XML Parsing Object by Cappadonna3030

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.