Hi teamassociated, I hope it helps.

#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; my %vhosts; my $host; #open (LSMAP, "-|", "/usr/ios/cli/ioscli lsmap -all") or die $!; while (defined(my $lsm = <DATA>)) { if ($lsm =~ /^(vhost\d+)/) { $host = $1 } if ($lsm =~ /^Backing device\s+([\w\.]+)/) { $vhosts{$host} = [] unless defined $vhosts{$host}; push $vhosts{$host}, $1; } } print Dumper( \%vhosts ) . "\n"; __DATA__ SVSA Physloc Client Pa +rtition ID --------------- -------------------------------------------- --------- +--------- vhost0 U9117.MMD.218A8B7-V1-C2 0x0000000 +b VTD vtscsi0 Status Available LUN 0x8100000000000000 Backing device l02duapofdev_r1.58ff94782d7c325acc49a8dd9c04bb1e Physloc Mirrored N/A VTD vtscsi1 Status Available LUN 0x8200000000000000 Backing device l02duapofdev_b1.0ee86903d4951ce38a9b691b322ff1d2 Physloc Mirrored N/A SVSA Physloc Client Pa +rtition ID --------------- -------------------------------------------- --------- +--------- -------------------------------------------- ------------------ vhost3 U9117.MMD.218A8B7-V1-C14 0x0000000 +0 VTD NO VIRTUAL TARGET DEVICE FOUND SVSA Physloc Client Pa +rtition ID --------------- -------------------------------------------- --------- +--------- vhost5 U9117.MMD.218A8B7-V1-C16 0x0000000 +7 VTD vtscsi22 Status Available LUN 0x8100000000000000 Backing device l02duapofqa_r1.4746343ea4f12fe1092615c8734d9844 Physloc Mirrored N/A VTD vtscsi23 Status Available LUN 0x8200000000000000 Backing device l02duapofqa1_d1.449583501d812f69e6189ea7f4a29e06 Physloc Mirrored N/A

In reply to Re: array of hash ref? by pme
in thread array of hash ref? by teamassociated

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.