On Jan 9, 2008 6:26 PM, ciwei <[EMAIL PROTECTED]> wrote:
> Thanks for answering my question.
> > I don't understand your second question, could you break your input
> > into records so we can clearly see what how you want to define the
> > records?
>
> My data looks like this: the rcord is variable in the number of
> lines.
> I'm tring to push all WWN that start with 1000 to initiator array.
> and all others into target array.
> Thanks.
>
>
> __DATA__
> DEV01-HBA0_DMX1-13CA <-- begin of record
> WWN: 10000000C934A35B
> WWN: 5006048ACAFE1E4C <-- end of record
> EST01_HBA1_STK_TAPES1 <-- begin of record
> WWN: 100000E002239270
> WWN: 500104F000619193
> WWN: 500104F00061918D
> WWN: 500104F000619190
> WWN: 500104F00061919D <-- end of record.
snip
my $record = <>; #prime the pump
while (my $line = <>) {
if ($line =~ /^\s*WWN/) {
$record .= $line;
next;
}
process_record($record);
$record = $line; #start a new record
}
process_record($record); #the last record gets processed here
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/