DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Paragraph Formatter

07.04.2007
| 2404 views |
  • submit to reddit
        Converts any nonempty lines in a document that don't start with whitespace into more conventional paragraphs
#!/usr/bin/perl -wni
# para.pl
use strict;

/^\s+/ || /^$/ ? print : write;
format ARGVOUT =
        ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$_
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
$_
.