On Thu, Aug 31, 2000 at 02:52:10PM -0400, Buddha Buck wrote:
> How would you do:
> 
> # Writer insists on blank line between paragraphs, first line indented.
> # Publisher insists on one paragraph/line, first word ALL CAPS.
> {
>     local $/ = ""; #slurp paragraph at a time.
>     while (<INFILE>) {
>        s/\n//gm;        # combine into one line
>        s/^\s//;         # get rid of indent
>        y/a-z/A-Z/l      # upcase first (English) word.

        s/(\w+)/\U$1/;                          # one way

        $word_ref = \substr($_,0,index($_,' '));
        $$word_ref =~ tr/a-z/A-Z/;              # one convoluted way

I'd do the former  :-)

tr/// does straight 1-to-1 mapping of characters regardless of position
within a string.  The /l and /t modifiers would make it act more like
a s/// than a tr/// (or so it seems to me), thus increasing the
already extant confusion.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to