in reply to Parsing a hash of hashes using a schema file
G'day NewLondonPerl1,
I had some real problems trying to equate your schema (both code and description) with the data you presented. Here's some of the issues:
Given all these problems, I am not able to provide a solution that uses your schema. However, the following code generates the output you want. When you've sorted out the schema issues, perhaps you can integrate that into this code. Here's pm_data_1026558.pl:
#!/usr/bin/env perl use strict; use warnings; my $input = do { local $/; <> }; $input =~ y/":/',/; my $data = eval $input; for my $file (qw{ny_loc nj_loc}) { print "$file file =\n"; for my $key (sort grep { ref $data->{$_} eq 'HASH' } keys %$data) +{ my $home_link_mpt = $data->{$key}{'home_nfs'}{'home-lnk-mpt'}; print join(':', $key, $home_link_mpt->{'%filer_device'}{$file}, $home_link_mpt->{'%filer_volume'}{$file}, $home_link_mpt->{'%export_name'} ), "\n"; } print "\n"; }
Here's the output. (The file pm_data_1026558.dat contains the first block of data you posted, verbatim.)
$ pm_data_1026558.pl pm_data_1026558.dat ny_loc file = @dev:nydevnfstest10_links:/vol/linkstest10:/links10 @fred:nydevnfs_links:/vol/links:/links nj_loc file = @dev:njdevnfstest11_links:/vol/linkstest11:/links10 @fred:njdevnfs_links:/vol/links:/links
-- Ken
|
|---|