Hamish Whittal said:

> 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.....

Something like this?

$NEWSTRUCT = $VAR1;
$NEWSTRUCT->{chassis} = delete $NEWSTRUCT->{device}{chassis};
$NEWSTRUCT->{card}    = delete $NEWSTRUCT->{chassis}{card};

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


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

Reply via email to