[email protected] wrote:
Hi All
Hello,
My array @sympd_list has following lines :
--------------------
/dev/sdd 0BE0 07F:0 08C:D0 Unprotected N/Grp'd RW 500
/dev/sde 0BE1 07F:0 07A:C0 Unprotected N/Grp'd RW 500
/dev/sdf 0BE2 07F:0 08D:C0 Unprotected N/Grp'd RW 500
/dev/sdg 0BE3 07F:0 07B:D0 Unprotected N/Grp'd RW 500
/dev/sdj 201A 07H:0 07A:D5 Unprotected N/Grp'd RW 3
---------------------------
I want second column in another array :
0BE0
0BE1
0BE2
0BE3
201A
I used map function with pattern matching as>>> my @sympd_dev_list =
map {$_ =~ s/^\/\S+\s+([0-9A-F]{4}).+/$1/ } @sympd_list;
That should be:
my @sympd_dev_list = map /^\/\S+\s+([0-9A-F]{4})\s/, @sympd_list;
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/