That worked well - Thanks.  Could you assist me into understanding what 
exactly that has done.

if ( /^\s+Device Capacity/ ) {    <-- I understand this, this is a normal 
regex search.
    local $/ = '}';                         <-- I understand this line, it 
makes the $INPUT_RECORD_SEPARATOR local to this block
    $device{ $symmSerial }{ symmvol }{ $symmvol }{ devicecapacity } =   <--  
I understand this, this is the hoh structure
        {  map split( /\s*:\s*/ ), map split( /\s*\n\s*/ ), <> =~   <-- Here 
is where I start to get lost, I have a basic understanding of the map 
function.
                                                                             
                          From this point on is where I need a better 
understanding of what is going on.
/\s*{\s+(.+)}/s };
    }

If anyone can assist into my knowlegde of what is going on here, I would 
greatly appreciate it.

Bryan Jones

"John W. Krahn" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Bryan Jones wrote:
> Hello all,

Hello,

> I am somewhat new to perl.  I have tried to read everything that I can.  I
> have a somewhat simple script, so might think.  I have attached the script
> and the file that I am reading to gather the data.  I am trying to parse
> this file to gather information and from here I will import the data into 
> a
> spreadsheet.  I need assistance on this one area with in the script.
>
> I have a few areas in the data file that has information that looks like 
> the
> following:
>
> Device Capacity
>     {
>         Cylinders    :    16
>         Tracks        :    240
>         512-byte Blocks    :    15360
>         MegaBytes    :    8
>         KiloBytes        :    7680
>     }
>
> What I am trying to do is to gather the data in between the { } so it 
> would
> look like such
> SymmSerial =>
>      symmvol =>
>            $symmvol =>
>                 {DeviceCapacity} =>
>                             {512-byteBlocks} => 15360,
>                             {MegaBytes}    => 8,
>                             {KiloBytes} => 7680,
>
> Above, there is only one for each symmvol.  I have multiple items like 
> this
> I would like to parse from the data file, such as Front Director Paths,
> Device Capacity(from above) and Back End Disk Director Information.

Here is one way to do it:


if ( /^\s+Device Capacity/ ) {
    local $/ = '}';
    $device{ $symmSerial }{ symmvol }{ $symmvol }{ devicecapacity } =
        {  map split( /\s*:\s*/ ), map split( /\s*\n\s*/ ), <> =~
/\s*{\s+(.+)}/s };
    }



John
-- 
use Perl;
program
fulfillment 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to