Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Mulitple values for a key in a hash

by gamache (Friar)
on Nov 29, 2007 at 14:45 UTC ( [id://653854] : note . print w/replies, xml ) Need Help??


in reply to Mulitple values for a key in a hash

Perhaps you could either form the hash key out of the hostname and filesystem, something like 'host1:/foo', 'host1:/bar', 'host2:/baz' etc, or you could key by hostname and have each value be a hashref keyed by filesystem.

I don't fully understand what you're doing, however, based on your code sample... There are a number of problems I can see at first glance:

  • "hosta => 1" is a string; did you want it to be a hashref? Same with "hostb => 2".
  • Avoid barewords like \/file\/system\/a; put in single quotes instead, like '/file/system/a'.
  • You try to put a hashref in $filesystems{1}{filesystem}, but it has an odd number of elements. Hashes and hashrefs should contain only key => value pairs.
  • You need a $ sigil on host in the last line.