title: How to Print Keys and Values from a Hash in this Format
body: <p>I am not sure what any of this called, I got it from a lab friend. I am trying to make Keys and Values for each X, Y, and Z Coordinates for specific particles but am having problems printing what I need or calling upon the assigned coordinates.</p>
  
  <p>This is my exact script:</p>
  
  <pre><code>#!/usr/bin/perl 
  
  use strict;
  use warnings;
  use diagnostics;
  
  #my $inputFile = $ARGV[0];
  my $inputFile = '8ns_emb_alt_101.pdb';
  
  open (INPUTFILE, "&lt;", $inputFile) or die $!;
  
  my @array = &lt;INPUTFILE&gt;;
  
  #check
  #print "@array \n";
  ######
  
  #### CoM of MET ####
  my $met_Sulfur = 'SD';
  my $met_CarbonB = 'CB';
  my $met_CarbonG = 'CG';
  my $met_CarbonE = 'CE';
  my $met_number = '34';
  
  my $COM_MET_Coords;
  
  for (my $line = 0; $line &lt;= $#array; ++$line){
     if (($array[$line] =~ m/\s+$met_Sulfur\s+/)&amp;&amp;($array[$line] =~ m/\s+$met_number\s+/)){
  #      print "$array[$line]";
        my @splitLine = (split /\s+/, $array[$line]);
        my %coordinates = (x =&gt; $splitLine[6],
                           y =&gt; $splitLine[7],
                           z =&gt; $splitLine[8],
                           );
       push @{$COM_MET_Coords-&gt;[0]}, \%coordinates;
     }
  }
  foreach my $line (@{$COM_MET_Coords-&gt;[0]}){
     print "$line-&gt;{'x'}\n";
  </code></pre>
  
  <p>I have also tried to print by using:</p>
  
  <pre><code>print $COM_MET_Coords-&gt;[0]-&gt;[0]-&gt;{'x'};
  </code></pre>
  
  <p>My main problem is that I don't totally understand how and where the information I want is being stored and I am not sure what this is called. I am using perl v5.10.1. If anyone can tell me how to print X Y and Z as well as why that would be Perfect!</p>
  
  <p>This is a Sample of the data:</p>
  
  <pre><code>ATOM    527  N   MET   34      -9.849  -0.893  17.835  0.00  0.00      PROT  
  ATOM    528  HN  MET   34      -9.231  -0.252  17.386  0.00  0.00      PROT  
  ATOM    529  CA  MET   34     -10.593  -1.664  16.897  0.00  0.00      PROT  
  ATOM    530  HA  MET   34     -11.657  -1.526  17.023  0.00  0.00      PROT  
  ATOM    531  CB  MET   34     -10.159  -1.300  15.525  0.00  0.00      PROT  
  ATOM    532  HB1 MET   34     -10.188  -2.148  14.808  0.00  0.00      PROT  
  ATOM    533  HB2 MET   34      -9.082  -1.050  15.637  0.00  0.00      PROT  
  ATOM    534  CG  MET   34     -10.806   0.010  15.045  0.00  0.00      PROT  
  ATOM    535  HG1 MET   34     -10.226   0.384  14.174  0.00  0.00      PROT  
  ATOM    536  HG2 MET   34     -10.755   0.660  15.945  0.00  0.00      PROT  
  ATOM    537  SD  MET   34     -12.551  -0.153  14.748  0.00  0.00      PROT  
  ATOM    538  CE  MET   34     -12.486  -0.712  13.101  0.00  0.00      PROT  
  </code></pre>