--0016369fa10ad8710d04ae1a9c4c
Content-Type: text/plain; charset=UTF-8

On Thu, Sep 29, 2011 at 10:39 PM, Joda jenson <jodajen2 / yahoo.com> wrote:

> Robert Klemme wrote in post #1024202:
> > On Thu, Sep 29, 2011 at 11:14 AM, Joda jenson <jodajen2 / yahoo.com>
> > wrote:
> >> puts filearray [0]
> >> filename1  "\"/home/user/file.txt\"")
> >>
> >> It will print the Double quote but still will not work if I pass it to
> >> the IO.readlines()
> >>
> >> It gives a (Errno::ENOENT)
> >>
> >> It doesn't seem to matter how I doctor a string with quotes I can't get
> >> IO.readlines() to accept it. Only hard coding it works for some reason.
> >
> > Insert a line after "gets" like this:
> >
> > puts "what is the name of the file
> > filename1  ets
> > p filename1 # look at the output
> >
> > filearray  O.readlines(filename)
> > puts filearray [0]
> >
> > You'll immediately see what's wrong. :-)
> >
> > Kind regards
> >
> > robert
>
> Robert I thought I had done that but the .inspect shows I am getting a
> "\n" at the end of the string.
>
> Thanks for the help on this sorry for the typo, it was really late when
> I
> was posting.
>
> What is the easiest why to get the "\n" off the end?
>

Look at chomp

peterv@ASUS:~$ irb
001:0> a  ets
test
"test\n"
002:0> a.chomp
"test"
003:0>

HTH,

Peter

--0016369fa10ad8710d04ae1a9c4c--