Hi,.
Newbie dumb question time ! Could somebody either give me an iniots guide to hashrefs or point me in the direction of one ? I can not get my head around the structure.
I have sucked in an XML file using XML::Simple and can dump the data quite nicely to screen as per the following
[CODE=perl]
$VAR1 = {
'ORDER' => [
{
'ORDER_NUMBER' => 'W-21670-3',
'DETAILS' => {
'LOCATION' => 'WGBASLBA',
'DATE' => '07/05/2006 12:30:19',
'VENDOR_REF' => 'FI15374820 KNCL1023',
'TYPE' => {},
'MOD_LEVEL' => 'EQU-INSTL-CPE',
'PART_NUMBER' => 'CIS-CAB-ETH-S-RJ45',
'DOMAIN' => 'Equant Non-serialized',
'SHIPPED_QTY' => '2',
'SERIAL_NO' => {}
}
},
{
'ORDER_NUMBER' => 'W-21670-4',
'DETAILS' => {
'LOCATION' => 'WGBASLBA',
'DATE' => '07/05/2006 12:31:25',
'VENDOR_REF' => 'FI15374820 KNCL1023',
'TYPE' => {},
'MOD_LEVEL' => 'EQU-INSTL-ZFS',
'PART_NUMBER' => 'SVP-CAB-RJ45-X',
'DOMAIN' => 'Equant Non-serialized',
'SHIPPED_QTY' => '1',
'SERIAL_NO' => {}
}
},
{
'ORDER_NUMBER' => 'W-11206-1',
'DETAILS' => {
'LOCATION' => 'WGBASMAN',
'DATE' => '03/02/2006 10:35:05',
'VENDOR_REF' => 'PMAN354 FI14162655',
'TYPE' => {},
'MOD_LEVEL' => 'EQU-INSTL-CPE',
'PART_NUMBER' => 'CIS-CISCO2610XM',
'DOMAIN' => 'Equant Serialized',
'SHIPPED_QTY' => '1',
'SERIAL_NO' => ' FCZ095071BE'
}
}
]
};
[/CODE]
I am having difficulty just starting to extract the data from the hashref now !
I want to be able to convert this data to a simple CSV output. - that bit I can do no problem if I just had the data available to me in standard scalars.
I guess my qwuestion is how to start to reference this data from within the script ?
Many Thanks
Keith
Newbie dumb question time ! Could somebody either give me an iniots guide to hashrefs or point me in the direction of one ? I can not get my head around the structure.
I have sucked in an XML file using XML::Simple and can dump the data quite nicely to screen as per the following
[CODE=perl]
$VAR1 = {
'ORDER' => [
{
'ORDER_NUMBER' => 'W-21670-3',
'DETAILS' => {
'LOCATION' => 'WGBASLBA',
'DATE' => '07/05/2006 12:30:19',
'VENDOR_REF' => 'FI15374820 KNCL1023',
'TYPE' => {},
'MOD_LEVEL' => 'EQU-INSTL-CPE',
'PART_NUMBER' => 'CIS-CAB-ETH-S-RJ45',
'DOMAIN' => 'Equant Non-serialized',
'SHIPPED_QTY' => '2',
'SERIAL_NO' => {}
}
},
{
'ORDER_NUMBER' => 'W-21670-4',
'DETAILS' => {
'LOCATION' => 'WGBASLBA',
'DATE' => '07/05/2006 12:31:25',
'VENDOR_REF' => 'FI15374820 KNCL1023',
'TYPE' => {},
'MOD_LEVEL' => 'EQU-INSTL-ZFS',
'PART_NUMBER' => 'SVP-CAB-RJ45-X',
'DOMAIN' => 'Equant Non-serialized',
'SHIPPED_QTY' => '1',
'SERIAL_NO' => {}
}
},
{
'ORDER_NUMBER' => 'W-11206-1',
'DETAILS' => {
'LOCATION' => 'WGBASMAN',
'DATE' => '03/02/2006 10:35:05',
'VENDOR_REF' => 'PMAN354 FI14162655',
'TYPE' => {},
'MOD_LEVEL' => 'EQU-INSTL-CPE',
'PART_NUMBER' => 'CIS-CISCO2610XM',
'DOMAIN' => 'Equant Serialized',
'SHIPPED_QTY' => '1',
'SERIAL_NO' => ' FCZ095071BE'
}
}
]
};
[/CODE]
I am having difficulty just starting to extract the data from the hashref now !
I want to be able to convert this data to a simple CSV output. - that bit I can do no problem if I just had the data available to me in standard scalars.
I guess my qwuestion is how to start to reference this data from within the script ?
Many Thanks
Keith
Comment