http://qs1969.pair.com?node_id=808195

blackadder has asked for the wisdom of the Perl Monks concerning the following question:

Bestest Monks

I am trying to creat a data structure like;
San device : SAN3 Lun Name : LUNName3 WW Names : 60:05:08:b2:00:bb:b6:93 60:05:08:b2:00:bb:b6:92 San device : SAN4 Lun Name : LUNName4 WW Names : 66:05:08:b2:00:7d:15:13 66:05:08:b2:00:7d:15:12 66:01:43:80:00:be:79:12 66:01:43:80:00:be:79:10
And so forth...

I wrote this bit of code which is not working!
my $xls_path = "c:/path_to_xls.xlsx"; my $xls = $excel->Workbooks->Open("$xls_path"); foreach my $sheet ( in $xls->Worksheets ) { $San ={}; $San->{name} = $sheet->Name, $/; my $San_data = $xls->Worksheets("$San->{name}"); my @Colum_A = $San_data->UsedRange->{'Value'}; if ( "$Colum_A[0]" =~ /ARRAY/) { $San->{note} = 'Live SAN Box'; foreach my $array (@{$Colum_A[0]}) { foreach (@$array) { my @wwn; next if ((uc $_) eq (uc "$San->{name}")); next if not defined $_; push (@{$San->{LUNs}},$_) if ($_ !~ /:/); foreach my $LUN (@{$San->{LUNs}}) { print "\n".$LUN.": ".$_."\n" if ($_ =~ /:/); } } } } else { $San->{note} = $Colum_A[0]; } #print Dumper $San; print "\n__________\n"; } __DATA__ LUNName1 60:05:08:b2:00:bb:b6:93 60:05:08:b2:00:bb:b6:92 LUNName1 66:05:08:b2:00:7d:15:13 66:05:08:b2:00:7d:15:12 66:01:43:80:00:be:79:12 66:01:43:80:00:be:79:10 LUNName3 66:05:08:b2:00:b2:95:23 66:05:08:b2:00:b2:95:22 66:05:08:b2:00:b2:ab:a3 89:05:08:b2:00:b2:ab:a2 89:05:08:b2:00:b2:b4:c3 89:05:08:b2:00:b2:b4:c2 LUNName4 89:05:08:b2:00:b2:36:c2 89:05:08:b2:00:b9:fa:13 89:05:08:b2:00:7c:bc:03 98:05:08:b2:00:b9:fa:12 70:05:08:b2:00:7c:bc:02 70:05:08:b2:00:b2:2c:b3 70:05:08:b2:00:b2:2c:b2 70:05:08:b2:00:75:6d:73
can someone pretty please advise how can I creat such data structures from the __DATA__ that I have?

In Fact; I don't slurp the data in, I populate an array direct from excel with
my @Colum_A = $San_data->UsedRange->{'Value'};
so I think this would be better
@Colum_A = qw/LUNName1 60:05:08:b2:00:bb:b6:93 60:05:08:b2:00:bb:b6:92 LUNName1 66:05:08:b2:00:7d:15:13 66:05:08:b2:00:7d:15:12 66:01:43:80:00:be:79:12 66:01:43:80:00:be:79:10 LUNName3 66:05:08:b2:00:b2:95:23 66:05:08:b2:00:b2:95:22 66:05:08:b2:00:b2:ab:a3 89:05:08:b2:00:b2:ab:a2 89:05:08:b2:00:b2:b4:c3 89:05:08:b2:00:b2:b4:c2 LUNName4 89:05:08:b2:00:b2:36:c2 89:05:08:b2:00:b9:fa:13 89:05:08:b2:00:7c:bc:03 98:05:08:b2:00:b9:fa:12 70:05:08:b2:00:7c:bc:02 70:05:08:b2:00:b2:2c:b3 70:05:08:b2:00:b2:2c:b2 70:05:08:b2:00:75:6d:73/;
Thanks

Blackadder