>How would you do:

># Writer insists on blank line between paragraphs, first line indented.
># Publisher insists on one paragraph/line, first word ALL CAPS.

Step 1: Fire the lame publisher.  I'm serious.  It's amazing
what people tolerate.  Some things aren't worth the pane.

>{
>    local $/ = ""; #slurp paragraph at a time.
>    while (<INFILE>) {
>       s/\n//gm;        # combine into one line

No, that should be s/\n/ /g, as otherwise you merge two
words and get for example "twowords" on this paragraph.

And that /m does nothing, as there's no ^ nor $ to affect.

>       s/^\s//;         # get rid of indent

Um, surely you mean s/^\s+// there instead.

>       y/a-z/A-Z/l      # upcase first (English) word.

Does that mean capitalize it, or reader all the word's letters
in uppercase?  I guess you said ALL CAPS, so, trivially enough,
it's merely

    s/(\w+)/\U$1/;

Whatcha doin' with tr anyway? :-)  That's what the vi escapes are for!

>       print OUTFILE;
>    }
>}

--tom

Reply via email to