title: store string with its value into an array: Perl
body: <p>I have a Perl file called <code>grabPet.pl</code> and a text file called <code>Pets.txt</code></p>
  
  <p>Each pet has a number of toys linked to them. So a: <code>cat=5</code></p>
  
  <p>cat will have 5 toys. They are separated by commas so:</p>
  
  <p><code>mouse=3, cat=5, dog=9,</code></p>
  
  <p>i want to output these into a formatted table.</p>
  
  <p>I am not looking for the answer just guidance on how I could approach it?</p>
  
  <p>I am thinking possibly a 2d array but I dont think perl supports it.</p>
  
  <pre><code>open(FILE, "&lt;pet.txt") || die"could not read);
  
  while (&lt;FILE&gt;) {
        push (@lines, $line);
    }
  
  close FILE;
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/F2Ej6.png" rel="nofollow">http://i.stack.imgur.com/F2Ej6.png</a></p>