Hi,

Thank you for showing me a better way to run the while loops, not
using the foreach loop, but the for loop and some
extra regex ways to accomplish things. Otherwise it prints out exactly
what I had before :-)

I have attached my request in a text file this time, to make it more
readable without email screwing up
the text alignment and formatting.

Please have a look and let me know how this could be done.

Basically, I need to compare the emcpower\w+\d partitions names from
the %allLocalMountedDisks hash
to that of the emcpower\w+ disks from the %allEmcMountedDisks hash.
I'm not sure, but I think the
emcpower\w+\d and emcpower\w+  names are the hash keys...? If so, then
I don't want to compare the
values/result of the hash keys, I just want to compare the hash keys
against another, and if matched
with =~ to append the key and values of %allLocalMountedDisks with the
matched keys and found values
found in %allLocalMountedDisks.

I know Perl is powerful, but until I understand Perl and hashes much
better I can't get this to work and
hope someone on this list can help me out so I can learn from that.

Please have a look at the attach text file where I try to explain as best I can.

Many thanks.

Kind regards,
Wernher
Thank you for correcting and showing me a better different way to do the while 
loops, but instead of the
two for loops printing the following out:

emcpowera   sdbd sddg sdfj sdhm   #  <- [1st for loop output]
emcpoweraa  sdae sdch sdek sdgn   # These the available emcpower disks and 
their associate devices
emcpowerbc  sdb sdbe sddh sdfk
emcpowerc   sdbb sdde sdfh sdhk
emcpowerd   sdba sddd sdfg sdhj   # <- [end of 1st for loop]

emcpowera1  /dwpdb006             # <- [2nd for loop output]
emcpoweraa1 /dwpdb033             # These are the local emcpower* disk 
paritions and their local mount points.
emcpowerbc1 /s00_11               # Note that the emcpowerbc disk has 2 
partitions, 1 and 2 below.
emcpowerbc2 /utl_file_dir
emcpowerc1  /odsdb006
emcpowerd1  /odsdb005             # <- [end of 2nd for loop]

How can I match the emcpower partitions ie: emcpowera1 as a result from the 2nd 
loop, to the emcpower disks 
ie: emcpowera as a result from the 1st loop.

What I would like to do is to compare what (emcpower\w+\d) partitions ie: 
emcpowera1 (seen from the output of
the 2nd for loop), where mounted against the available list of the 
(emcpower\w+) disk devices ie: emcpowera
(found in the 1st output) and then match on the (emcpower\w+) disk found (from 
1st output). The result of the 
output of the matched partition found (2nd output) must concatenate to the 
result of the emcpower disk (1st output), 
and then also show the (emcpower\w+) disks (from 1st output) that wasn't 
matched, if any.

In other words,

If emcpowera1 was found (from 2nd output), to match with emcpowera (from 1st 
output) and display the result 
along with the mount point that was found for emxpowera1 like this:

   emcpowera sdbd sddg sdfj sdhm emcpowera1 /dwpdb006

If there are any (emcpower\w+) disks ie: emxpowerz that wasn't matched by a 
(emxpower\w+\d) partition ie: emxpowerz1, 
to then only display normal output found in loop 1, because it doesn't have a 
matching partition ie:

    emcpowerz sdbg sddv sdfd sdht

If there are more than one (emcpower\w+\d) partition, to display the output for 
example like this:

    emcpowerbc      sdb sdbe sddh sdfk  emcpowerbc1 /s00_11
                                        emcpowerbc2 /utl_file_dir

So the end result from the above should for example display:

emcpowera   sdbd sddg sdfj sdhm  emcpowera1  /dwpdb006
emcpoweraa  sdae sdch sdek sdgn  emcpoweraa1 /dwpdb033
emcpowerbc  sdb sdbe sddh sdfk   emcpowerbc1 /s00_11
            sdba sddd sdfg sdhj  emcpowerbc2 /utl_file_dir
emcpowerc   sdbb sdde sdfh sdhk  emcpowerc1  /odsdb006
emcpowerd   sdba sddd sdfg sdhj  emcpowerd1  /odsdb005
emcpowerz   sdbg sddv sdfd sdht
-- 
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