doublek321 has asked for the wisdom of the Perl Monks concerning the following question:
------------------------------------------------ #!/usr/bin/perl my $MaxLineLength = 8060; $search = '<COLUMNS>'; $replace = '<DATA>'; $searchEnd = '</COLUMNS>'; $replaceEnd = '</DATA>'; $fileContents = ''; while (<STDIN>) { if (/(^<DATA>\t).*(<\/DATA>$)/) { if (length() <= $MaxLineLength) { print; } } elsif (/(^<COLUMNS>\t).*(<\/COLUMNS>$)/) { s/$search/$replace/g; s/$searchEnd/$replaceEnd/g; print; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Newline Problem
by polettix (Vicar) on Jun 30, 2005 at 15:06 UTC | |
by ikegami (Patriarch) on Jun 30, 2005 at 16:15 UTC | |
by doublek321 (Initiate) on Jul 05, 2005 at 19:52 UTC | |
|
Re: Newline Problem
by Tanktalus (Canon) on Jun 30, 2005 at 15:04 UTC | |
by polettix (Vicar) on Jun 30, 2005 at 15:09 UTC |