"Pandey Rajeev-A19514" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Paul, > > I has tried the $/ = ""; but it did not work because my logfile itself was faulty. > The problem is that between two paragraphs, the empty line does not match /^\n$/ but > it matches some spaces too i.e. /^\s*\n$/. > > Probably that is the reason it fails. I guess. but I cant give any regex for $/ > > currently I am making record by running in a loop. Do you feel > that I am missing something silly.
You can read the entire file into a scalar like this: use strict; use warnings; my $lines; { local $/; open(IN, 'abc') or die $!; $lines = <IN>; close IN; } and then split each bunch of lines like this: my @lines = split /\n\s*\n/, $lines; which will split on a blank line which may include whitespace. Then you'll have this: @lines = ( "AAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBB", "CCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCC"); Is that what you want? Note that there is no newline after the last line of data in each block, but that's easy enough to fix if it matters. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]