Re: Assistance needed with script.......
- From: bryan.jones@xxxxxxxxxx (Bryan Jones)
- Date: Sun, 18 Sep 2005 16:46:37 -0500
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" <krahnj@xxxxxxxxx> wrote in message
news:432CD4D3.10505@xxxxxxxxxxxx
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
> spread***. 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
.
- Follow-Ups:
- Re: Assistance needed with script.......
- From: John Doe
- Re: Assistance needed with script.......
- References:
- Assistance needed with script.......
- From: Bryan Jones
- Re: Assistance needed with script.......
- From: John W. Krahn
- Assistance needed with script.......
- Prev by Date: Re: @ARGV
- Next by Date: Re: @ARGV
- Previous by thread: Re: Assistance needed with script.......
- Next by thread: Re: Assistance needed with script.......
- Index(es):