Xref: utzoo comp.lang.perl:5194 alt.sources:3697 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!mimsy!mojo!mojo!djm From: djm@eng.umd.edu (David J. MacKenzie) Newsgroups: comp.lang.perl,alt.sources Subject: replacing " with `` and '' Message-ID: Date: 4 May 91 03:59:42 GMT Sender: news@eng.umd.edu (C-News) Organization: Project GLUE, University of Maryland Lines: 26 Here's a little script I wrote when I needed to typeset some documents that had been written with a word processor. Anyone have a better way to do this in perl? #!/usr/local/bin/perl # Change " to `` and '' for typesetting. # Leave unchanged lines that start with `.', `'', or `\"', # because they are probably troff code. # David MacKenzie, djm@eng.umd.edu $leftquote = 1; while (<>) { if (!(/^[.\']/ || /^\\\"/)) { while (/\"/) { if ($leftquote) { s/\"/\`\`/; } else { s/\"/\'\'/; } $leftquote = !$leftquote; } } print; } -- David J. MacKenzie