Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Newlines in prints Message-ID: <11507@jpl-devvax.JPL.NASA.GOV> Date: 20 Feb 91 02:35:04 GMT References: <1991Feb20.000312.5870@uvaarpa.Virginia.EDU> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 25 In article <1991Feb20.000312.5870@uvaarpa.Virginia.EDU> worley@compass.com writes: : I'd like a simpler way to end a print line with a newline than : appending : , "\n" : to the print. I looked at what it might take to make a naked : \n : at the end of a print mean "\n", but a naked \n is treated as the : symbol 'n' -- not too promising. And you can hardly use "/" as a : separator in place of "," to mean "add newline", as you do in Fortran. : Perhaps what I really want is to go back to Basic-Plus, where the : newline was implicit unless the print was ended with ";". Well, you can save two characters by defining $n = "\n", but it sounds more like you want to set $\ to "\n" and then have a subroutine for printing without the newline: sub nprint { local($\) = ''; print @_; } Incidentally, along these same lines, I just added a switch to do autochopping and auto-$\-setting, so the colrm 81 program can be emulated now with perl -lpe 'substr($_,80) = ""' Larry