Hi,

>From the folowing list is a result of the @power array, when run
through the foreach loop:

Pseudo name=emcpowerd
  1 lpfc                      sdba     SP A7     active  alive      0      0
  1 lpfc                      sddd     SP B7     active  alive      0      0
  3 lpfc                      sdfg     SP B6     active  alive      0      0
  3 lpfc                      sdhj     SP A6     active  alive      0      0
Pseudo name=emcpowerc
  1 lpfc                      sdbb     SP A7     active  alive      0      0
  1 lpfc                      sdde     SP B7     active  alive      0      0
  3 lpfc                      sdfh     SP B6     active  alive      0      0
  3 lpfc                      sdhk     SP A6     active  alive      0      0
Pseudo name=emcpoweraz
  1 lpfc                      sdbh     SP B7     active  alive      0      0
  3 lpfc                      sddk     SP B6     active  alive      0      0
  1 lpfc                      sde      SP A7     active  alive      0      0
  3 lpfc                      sdfn     SP A6     active  alive      0      0

>From the list above, how can Perl assign the sd* disks to it's
relevant emcpower device, so that the output shows this:

emcpowerd    sdba sddd sdfg sdhj
emcpowerc    sdbb sdde sdfh sdhk
emcpoweraz  sdbh sddk sde sdfn

This is how the @power array was obtained:

$powermt = 'powermt display dev=all';
@power = `$powermt`;

foreach my $i (@power) {
       if (($i =~ /emcpower*/) || ($i =~ /lpfc*/)) {
               print $i;
       }
}

Thanks,
Wernher

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to