title: Hash Constants in Perl
body: <p>I have a situation where I have an application and it maps to a directory I need to process in a zipfile. The mapping is quite simple:</p>
  
  <pre><code>CWA =&gt; "Financial",
  PIP =&gt; "",
  IFA =&gt; "IFA",
  VDX =&gt; "Financial,
  </code></pre>
  
  <p>That is, if the name of the file begins with <code>CWA</code>, I know the directory I have to munge is under <code>Financial</code>. If the file name begins with a <code>IFA</code>, I know the directory name is <code>IFA</code>. I'd like to set this up as a hash (easy enough), but since these values don't really change, I'd like to setup this key => value mapping as a hash constant.</p>
  
  <p>I don't believe this is possible, so I'd like to do the next best thing. What would that be? Or, can you setup a hash constant?</p>
  
  <p>I'm thinking of writing a subroutine where you pass a parameter and it returns the correct value. After all, it's really the way constants themselves work, and it'd guarantee that the relationships between the keys and values don't change through out the program.</p>
  
  <p>Or, I can simply declare the key => value relationship in the beginning of my program and hope that the key => value pairs aren't modified by something. This would be easier to read, and easier to modify if you have to since it's on the very top of my source code.</p>
  
  <p>What's the best way to implement a key => value constant?</p>