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


In reply to Re: Parsing a hash of hashes using a schema file by kcott
in thread Parsing a hash of hashes using a schema file by NewLondonPerl1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.