From: Axel Etzold Date: 2008-07-11T19:03:31+09:00 Subject: Re: Trying to write a first plain ruby script -------- Original-Nachricht -------- > Datum: Fri, 11 Jul 2008 17:05:54 +0900 > Von: Jesse Crockett > An: ruby-talk@ruby-lang.org > Betreff: Trying to write a first plain ruby script > In irb, the method "one\ntwo\nthree".split worked fine > > but in a file.. > ------------------------------- > @text = " > > line one > line two > line three > " > > @lines = @text.split(/\n/) > ------------------------------- > > .. it fails: "private method `split' called for nil:NilClass > (NoMethodError)" > > After getting the array of lines, again I need to call split() on each > line, then joing them with ", " > > (basically I need a CSV file for 14,000 lines verb annotation from > WordNet) > > It's late, so I probably could not figure this out myself tonight. Any > help is welcome. Thank you. > -- > Posted via http://www.ruby-forum.com/. Dear Jesse, I cannot reproduce your error on Ubuntu Linux ... did you really post the exact text/code ? What operating system are you working on ? I suspect that the line breaks might be \r\n instead of just \n (especially if the text file was created on Windows), and that @lines = @text.split(/\n|\r\n/) would work. Best regards, Axel -- Psssst! Schon vom neuen GMX MultiMessenger geh�rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger