[EMAIL PROTECTED] wrote:
> I decided to try 122 but it doesn't work..
> 
> Any ideas?
> 
> speach () { cat $1 | 
>               perl -n00e'tr/\n\n/\122/s; # this is experimental

tr/// translates characters so tr/\n/\122/s; does the same thing as
tr/\n\n/\122/s;

The character "\122" is the same as 'R' so that could aslo be written as:

tr/\n/R/s;

If you are modifying text files then you probably already have some 'R'
characters in the file so you may want to pick a character that is not
normally found in text files like "\0".


>                         tr/\t\r\n/ /s; 
>                         tr/\122/\n/s;    # this is experimental
>                         print qq($1\n) while s/^(.{0,36}\S)\s+//;
>                         print qq(\n)' |



>               perl -pe 'if ($.%4==2) {$_ .= qq(\n).(q(-) x 37).qq(\n)} 
>                           elsif ($.%4==0) {$_ .= qq(\n).(q(=) x 37).qq(\n)} 
>                           else {$_ .= qq(\n)}' ;}

That could also be written as:

                perl -pe '$_ .= $/ . ( $. % 4 == 2
                                     ? ( q(-) x 37 ) . $/ : $. % 4 == 0
                                     ? ( q(=) x 37 ) . $/ : q() )'




John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to