All, 

 

I am trying to populate a scalar (ideally a hash) using a Perl grep but
it is not working.  I even tried to use an array and no data was pushed.

 

use strict;

use warnings;

 

my @lvs;

my @lvaray = qx(bdf);

foreach (@lvaray) {

 if (/(?)vg00/) {

    push @lvs, (split)[0]

 }

    }

 

    my %hash = ();

    my (@key2,$value2) = 0;

    foreach (@lvs) {

        $key2[$value2++] = (grep /mirror/gi, `lvdisplay $_` );

    }

 

print $key2[1];

 

What my hash should print for testing is data as such:

 

--- Logical volumes ---

LV Name                     /dev/vg00/lvol1

VG Name                     /dev/vg00

LV Permission               read/write

LV Status                   available/syncd

Mirror copies               1

Consistency Recovery        MWC

Schedule                    parallel

LV Size (Mbytes)            512

Current LE                  64

Allocated PE                128

Stripes                     0

Stripe Size (Kbytes)        0

Bad block                   off

Allocation                  strict/contiguous

IO Timeout (Seconds)        default

 

But I only want the lines:  lv name /dev/vg00/lvol1 and mirror copies 1

For a key value relantionship.

 

Thank you

 

Derek

 

 

Derek Bellner Smith

Unix Systems Engineer

Cardinal Health Dublin, Ohio

614-757-5000 Main

614-757-8075 Direct

614-757-8120 Fax

[EMAIL PROTECTED]

 


Cardinal Health -- Working together. For life. (sm)
_________________________________________________

This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.

Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk 
- Portuguese - Svenska: www.cardinalhealth.com/legal/email

Reply via email to