title: Parsing YAML file with perl. How to access and parse different yaml objects.
body: <p>I'm looking for some help parsing a YAML document.  Specifically i'm not sure host to print out/access the "volumes" elements.  Any help would be greatly appreciated. Thanks in advance!</p>
  
  <p>perl code:</p>
  
  <pre><code>#!/usr/bin/perl
  
  use YAML::Tiny;
  
  
  # Open the config
  $yaml = YAML::Tiny-&gt;read( 'file.yml' );
  
  # Reading properties
  my $root = $yaml-&gt;[0]-&gt;{rootproperty};
  my $one  = $yaml-&gt;[0]-&gt;{physical_interfaces}-&gt;{e0a};
  my $Foo  = $yaml-&gt;[0]-&gt;{physical_interfaces}-&gt;{e0b};
  print "$root\n";
  print "$one\n";
  print "$volume1\n";
  </code></pre>
  
  <p>my yaml file looks like this: file.yaml</p>
  
  <pre><code>---
      rootproperty: netapp1
      is_netapp: Yes
      netapp_mode: 7mode
      is_metro_cluster: Yes
      is_vseries: Yes
      is_flexcache_origin: No
      snapmirror:
        enabled: Yes
        destination: Yes
        lag_threshold: 2300
      physical_interfaces:
        e0a: netapp1-e0
        e0b: netapp1-e1
        mgt: netapp1-mgt
      volumes:
        - volume: vol1
          reserve: 50
          sched: 6 42 0
        - volume: vol2
          reserve: 20
          sched: 0 3 0
  </code></pre>