Input: system command

Output: HoH

Problem: system command with lots of garbage output.

Goal: To create a HoH with SAN_VC0_## as the key and the hdisk string plus its serial as the values.

All I need is a single hdisk# string from the below system command output. Thank you! Here is what I have tried:

use strict; for my $lun ( ('SAN_VC0_42','SAN_VC0_43') ) { $luns_to_hdisk {$lun} = { grep /hdisk\d+/, qx(vxdisk list $lun) } ; } print Dumper(\%luns_to_hdisk); $VAR1 = { 'SAN_VC0_43' => { 'hdisk855 state=enabled ' => 'hdisk920 state=enabled ', 'hdisk587 state=enabled ' => 'hdisk652 state=enabled ', 'hdisk51 state=enabled ' => 'hdisk116 state=enabled ', 'hdisk319 state=enabled ' => 'hdisk384 state=enabled ' }, 'SAN_VC0_42' => { 'hdisk571 state=enabled ' => 'hdisk636 state=enabled ', 'hdisk35 state=enabled ' => 'hdisk100 state=enabled ', 'hdisk303 state=enabled ' => 'hdisk368 state=enabled ', 'hdisk839 state=enabled ' => 'hdisk904 state=enabled ' } };
Output of system command:
$ vxdisk list SAN_VC0_42 Device: SAN_VC0_42 devicetag: SAN_VC0_42 type: auto info: format=none flags: online ready private autoconfig invalid pubpaths: block=/dev/vx/dmp/SAN_VC0_42 char=/dev/vx/rdmp/SAN_VC0_42 Multipathing information: numpaths: 8 hdisk35 state=enabled hdisk100 state=enabled hdisk303 state=enabled hdisk368 state=enabled hdisk571 state=enabled hdisk636 state=enabled hdisk839 state=enabled hdisk904 state=enabled

In reply to trying HoH by mikejones

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.