home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7413 < prev    next >
Encoding:
Text File  |  1992-12-14  |  999 b   |  32 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!think.com!ames!sgi!wdl1!wdl39!mab
  3. From: mab@wdl39.wdl.loral.com (Mark A Biggar)
  4. Subject: Re: programming challenge
  5. Message-ID: <1992Dec14.185822.7058@wdl.loral.com>
  6. Sender: news@wdl.loral.com
  7. Organization: Loral Western Development Labs
  8. References: <1992Dec12.100131.11703@zooid.guild.org> <1992Dec14.114044.22303@cs.ruu.nl>
  9. Date: Mon, 14 Dec 1992 18:58:22 GMT
  10. Lines: 20
  11.  
  12. This looks like a job for s.... oops he's dead, oh well how about the 
  13. 's' modifier of the tr command like so:
  14.  
  15. perl -pie 'tr///cs/;' <files>
  16.  
  17. which zaps all consecutive chars in the files.  
  18. To limit it to just letters use:
  19.  
  20. perl -pie 'tr/a-zA-Z//s;' <files>
  21.  
  22. but of course this doesn't really solve the 'Goofy' problem which doesn't
  23. have a general solution even with the addition of dictionary lookup because
  24. word pairs like 'met' vs 'meet'.  That problem looks like it take a full
  25. English understanding AI to solve.
  26.  
  27. --
  28. Perl's Maternal Uncle
  29. Mark Biggar
  30. mab@wdl1.wdl.loral.com
  31.  
  32.