Appologies for not making myself clear first time round. Let me try that
again:

I have said XML file, which when read in using XML::Simple leaves me
with below data structure.

Now, I want to end up with:
$NEWSTRUCT = { 
'device' => {
       'sysObjectID' => '.1.3.6.1.4.1.9.1.219',
       'commonModel' => '2900',
       'make' => 'cisco'
},
'chassis' => {
        'romSysVersion' => '.1.3.6.1.4.1.9.3.6.5.1001',
        'processorRam'  => '.1.3.6.1.4.1.9.3.6.6.1001',
        'chassisVersion'=> '.1.3.6.1.4.1.9.3.6.2.1001',
        'romVersion'    => '.1.3.6.1.4.1.9.3.6.4.1001',
        'chassisSlots'  => '.1.3.6.1.4.1.9.3.6.12.1001',
        'nvRAMSize'     => '.1.3.6.1.4.1.9.3.6.7.1001'
},

etc.

So, I want to 'flatten' the data structure.....

Thanks for looking at this a second time.

I owe you.
;-)
H
> > $VAR1 = {
> >           'device' => {
> >                         'sysObjectID' => '.1.3.6.1.4.1.9.1.219',
> >                         'chassis' => {
> >                                        'chassisType' =>
> > '.1.3.6.1.4.1.9.3.6.1.1001',
> >                                        'chassisId' =>
> > '.1.3.6.1.4.1.711.2.1.1.2.1001',
> >                                        'card' => {
> >                                                    'cardType' =>
> > '.1.3.6.1.4.1.9.3.6.11.1.2.1001',
> >                                                    'cardIndex' =>
> > '.1.3.6.1.4.1.711.2.1.2.1.1.1.1001',
> >                                                    'cardSwVersion' =>
> > '.1.3.6.1.4.1.9.3.6.11.1.6.1001',
> >                                                    'cardDescr' =>
> > '.1.3.6.1.4.1.9.3.6.11.1.3.1001',
> >                                                    'cardHwVersion' =>
> > '.1.3.6.1.4.1.9.3.6.11.1.5.1001'
> >                                                  },
> >                                        'romSysVersion' =>
> > '.1.3.6.1.4.1.9.3.6.5.1001',
> >                                        'processorRam' =>
> > '.1.3.6.1.4.1.9.3.6.6.1001',
> >                                        'chassisVersion' =>
> > '.1.3.6.1.4.1.9.3.6.2.1001',
> >                                        'romVersion' =>
> > '.1.3.6.1.4.1.9.3.6.4.1001',
> >                                        'chassisSlots' =>
> > '.1.3.6.1.4.1.9.3.6.12.1001',
> >                                        'nvRAMSize' =>
> > '.1.3.6.1.4.1.9.3.6.7.1001'
> >                                      },
> >                         'commonModel' => '2900',
> >                         'make' => 'cisco'
> >                       }
> >         };
> > 
> > What, in your (collective) opinion, would be the best way of obtaining
> > all the information regarding a card, or chassis or device?
> > 
> > i.e. I want to be able to say, insert the details regarding a card into
> > the database and it should return:
> > 'card' => {
> >      'cardType' => '.1.3.6.1.4.1.9.3.6.11.1.2.1001',
> >      'cardIndex' => '.1.3.6.1.4.1.711.2.1.2.1.1.1.1001',
> >      'cardSwVersion' => '.1.3.6.1.4.1.9.3.6.11.1.6.1001',
> >      'cardDescr' => '.1.3.6.1.4.1.9.3.6.11.1.3.1001',
> >      'cardHwVersion' => '.1.3.6.1.4.1.9.3.6.11.1.5.1001'
> > }
> > 
> > I have been battling with this problem for a couple of days without
> > success.
> > Thanks in advance,
> > 
> > Hamish
> > 
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> ____________________________________________
> Confidential:  This electronic message and all contents contain information
> from Syntel, Inc. which may be privileged, confidential or otherwise
> protected from disclosure. The information is intended to be for the
> addressee only. If you are not the addressee, any disclosure, copy,
> distribution or use of the contents of this message is prohibited.  If you
> have received this electronic message in error, please notify the sender
> immediately and destroy the original message and all copies.
-- 
You are not defined by what loves you, but what you love - Nicholas Cage
(Adaptation, 2003)
---
Hamish Whittal
QED Technologies cc
+27 82 803 5533


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

Reply via email to