home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / perl / 5271 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  1.4 KB

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