Timothy Duke <[EMAIL PROTECTED]> wrote: : : Also, I understand that the <> operator reads in one : line at a time. If I wish to eliminate only triple : line-feeds (\n\n\n) and leave double and single : linefeeds, I presume <> won't work. Without reading : in the whole file at once, how can I achieve this?
The diamond operator uses the record separator ($/) to determine what a line ending looks like. By setting this to "\n\n\n" we get "lines" that have "\n\n\n" at the end. Conveniently, 'chomp' also uses $/ to figure out what needs to be lopped off a line. It is best to limit a change in $/. The 'local' function does this in a code block. { local $/ = "\n\n\n"; while ( <DATA> ) { chomp; print; } } # $/ back to its old value __END__ foo foo foo foo HTH, Prints: foo foo foo foo HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>