countzero, I rather think annie06 does mean that - a volume has only to be unique on a specific host - thus volumes having the same name can legitimately exist on one, or more, different hosts.

This applies to all OSes, even (tho' it pains me greatly to say it) Windoze - every Windoze host has a C: drive, which, in this context, can be taken to be the equivalent of a volume name.

IMO. the question (to ask of annie06) ought to be: 'Are all volumes the same size on every host?'

My reading of the OP suggests that where ever i.e. on which ever host, vol2 exists, it is always 20g, so a simplified version of the lookup table based approach (similar to that outlined by kennethk) should suffice - something along the lines of i.e. untested ...

use warnings; use strict; use autodie; #for each vol_size_entry in the volsize file do # add the vol_size_entry to the volsize lookup (keyed on vol name) #done open FILE, "<volsize"; my %volsize = map { local @_ = split; # $_[1] needs normalising (to chosen common units) and removal of +unit spec /_name/ ? () : ($_[0] => $_[1]); } <FILE>; close FILE; #for each host_entry do # lookup the size of the vol for the host # add the vol size to the record for the host #done open FILE, "<hostfile"; my %hostsize; while (<FILE>) { next if /_name/; local @_ = split; $hostsize{$_[1]} += $volsize{$_[0]}; } close FILE;

A user level that continues to overstate my experience :-))

In reply to Re^4: hashes with multiple keys by Bloodnok
in thread hashes with multiple keys by annie06

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.