in reply to Re^3: Creating a table from raw data!
in thread Creating a table from raw data!
And i want to create a data structure like thisRDUB010 34:34:36:7U 87:23:89:6C RDUB090 90:39:12:6U 34:34:36:7Z 87:23:89:6N 34:38:36:7U
So I put this PERL script together to do the job;San : SAN_01 Lun: RDUB010 WWn1: 34:34:36:7U WWn2: 34:34:36:7U Lun: RDUB090 WWn1:90:39:12:6U WWn2:34:34:36:7Z WWn3:87:23:89:6N WWn4:34:38:36:7U San: SAN_02 . . . and so forth
When I ran the script I get this output, which is wrong#! c:/perl/bin/perl.exe # # use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Data::Dumper qw/Dumper/; use vars qw/$Storage/; my $data; $Win32::OLE::Warn =2; my $excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32: +:OLE->new('Excel.Application'); my $xls_path = "c:\\test.xlsx"; my $xls = $excel->Workbooks->Open("$xls_path"); foreach my $sheet ( in $xls->Worksheets ) { $Storage ={}; $Storage->{SAN} = $sheet->Name, $/; print $Storage->{SAN}."\n"; my $San_data = $xls->Worksheets("$Storage->{SAN}"); my @Colum_A = $San_data->UsedRange->{'Value'}; foreach my $array (@Colum_A) { foreach my $element (@$array) { foreach my $info (@$element) { if ($info !~ /:/) { next if not defined $info; push (@{$Storage->{LUNs}}, "$info"); } if ($info =~ /:/) { push (@{$Storage->{LUNs}}->{WWN}}, "$info"); } } } print "\n_______________\n"; } print Dumper $Storage; }
Could someone for the love of God or Perl tell me where am I going wrong and what can I do to get it right? THANKS A BUNCHSAN_01 ______________ $VAR1 = { 'ARRAY(0x1b68610)' => { 'WWN' => [ '34:34:36:7U', '87:23:89:6C', '90:39:12:6U', '34:34:36:7Z', '87:23:89:6N', '34:38:36:7U', ] }, 'LUNs' => [ 'RDUB010', 'RDUB090' ], 'SAN' => 'SAN_01' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Creating a table from raw data!
by graff (Chancellor) on Nov 19, 2009 at 22:24 UTC | |
|
Re^5: Creating a table from raw data!
by johngg (Canon) on Nov 19, 2009 at 23:32 UTC | |
|
Re^5: Creating a table from raw data!
by BioLion (Curate) on Nov 20, 2009 at 10:18 UTC |