From groovy-user Fri Nov 28 10:26:40 2008 From: "Claus Hausberger" Date: Fri, 28 Nov 2008 10:26:40 +0000 To: groovy-user Subject: Re: [groovy-user] How to easily read from System.in? Message-Id: <20081128102640.159690 () gmx ! net> X-MARC-Message: https://marc.info/?l=groovy-user&m=122786801200931 thanks for all your answers. That's very helpful. I will use this version from now on. Claus > a bit more Groovy idiomatic: > > System.in.withReader { > print 'input: ' > println it.readLine() > } > > cheers > Dierk > > Am 27.11.2008 um 21:27 schrieb Claus Hausberger: > > > Hello > > > > I want to port some old Perl scripts to Groovy. In those scripts I > > have to read a lot from System.in. > > > > I got this program working: > > > > > > BufferedReader br = new BufferedReader(new > > InputStreamReader(System.in)) > > print "input:" > > String input = br.readLine() > > println "input was:$input:" > > > > > > It does exactly what I want but I wanted to ask if there is a > > shorter, more Groovy way to do this. > > > > > > Claus > > -- > > Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit > > allen: http://www.gmx.net/de/go/multimessenger > > > > --------------------------------------------------------------------- > > To unsubscribe from this list, please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email