On Jul 16, 2004, at 08:26, William Goedicke wrote:

Dear Y'all -

I've been struggling with the following problem.  I've got a data
structure that Dumper displays as:

$VAR1 = {
    'TARGETTABLE' => {
        'SOURCETABLE' => [
            {
              'ID' => 'S1',
              'NAME' => 'PS_DIVERSITY',
              'SOURCEFIELD' => [],
              'DBID' => 'SDB1'
            }
             ],
        'ID' => 'T1',
        'NAME' => 'SDM_PERSON_DIM',
        'DBID' => 'TDB1'
         }
  };

I need to push the following onto the SOURCEFIELD array:

   {
    'NAME'=>$results[0],
    'ID'=>$id,
    'TYPE'=>$results[1],
    'TARGETFIELD'=>$id+100000
   };

And, pure and simple, I can't get the syntax right.

One other thing, the goal of this code is to create an XML file
that matches a given DTD, so as long as I want to continue using
XML::Simple (which I really would prefer) I'm stuck with the data
structure because it creates *exactly* the XML I need.

my @results = qw(foo bar); my $id = 42; push @{$VAR1->{TARGETTABLE}{SOURCETABLE}[0]{SOURCEFIELD}}, {NAME=>$results[0],ID=>$id,TYPE=>$results[1],TARGETFIELD=>$id+10000};

...

$VAR1 = {
  'TARGETTABLE' => {
    'ID' => 'T1',
    'SOURCETABLE' => [ {
      'SOURCEFIELD' => [{
        'TYPE' => 'bar',
        'ID' => 42,
        'TARGETFIELD' => 10042,
        'NAME' => 'foo'
       } ],
     'ID' => 'S1',
     'DBID' => 'SDB1',
     'NAME' => 'PS_DIVERSITY'
    } ],
  'DBID' => 'TDB1',
  'NAME' => 'SDM_PERSON_DIM'
} };

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to