home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!uwm.edu!ogicse!reed!romulus!merlyn
- From: merlyn@romulus.reed.edu (Randal L. Schwartz)
- Newsgroups: comp.lang.perl
- Subject: Re: Q: nroff output to Epson-like printer conversion
- Message-ID: <MERLYN.92Aug12070337@romulus.reed.edu>
- Date: 12 Aug 92 14:03:41 GMT
- Article-I.D.: romulus.MERLYN.92Aug12070337
- References: <1992Aug12.033255.1153@ramsey.cs.laurentian.ca> <1992Aug12.074509.703@irfu.se>
- Sender: news@reed.edu (USENET News System)
- Organization: Reed College
- Lines: 28
- In-Reply-To: jhd@irfu.se's message of 12 Aug 92 07:45:09 GMT
-
- In article <1992Aug12.074509.703@irfu.se> jhd@irfu.se (Jan D.) writes:
- How about
-
- # Assuming one line of nroff output in $_
- while (/((.\010_)+)/){
- local($old, $word) = $1;
- ($word = $old) =~ s/\010_//g;
- s/$old/$begin_uline$word$end_uline/;
- }
-
- That looks like a lot of work. How about:
-
- s/(.)\010_/$begin_uline$1$end_uline/g;
- s/$end_uline$begin_uline//g;
-
- You could also do bold like:
-
- s/(.)\010\1/$begin_bold$1$end_bold/g;
- s/$end_bold$begin_bold//g;
-
- presuming bolding is done by putting the same character twice in the
- same spot. (If not, consider this merely a training exercise. :-)
-
- @a=("1Perl ","3Just ","0hacker,","2another ");for(@a[@a]){s/.//;print;}
- --
- Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
- merlyn@reed.edu (guest account) merlyn@ora.com (better for permanent record)
- cute quote: "Welcome to Portland, Oregon -- home of the California Raisins!"
-