From: "J.Hawkesworth" Date: 2002-10-30T21:29:14+09:00 Subject: Re: How do I get a '\'? Simon, Thanks for this. I *think* the (obvious when you think about it) thing I've learned today is that ruby uses inspect when generating error messages: I headed off down this blind alley when I got an error something like: t.rb:1:in `open': No such file or directory - "J:\\dir\\subdir\\" (Errno::ENOENT) from t.rb:1:in `entries' from t.rb:1 .. and I assumed that "J:\\dir\\subdir\\" was what ruby was 'seeing'. I must look elsewhere for the true cause of my bug. All the best, Jon -----Original Message----- From: simon@squash [mailto:simon@squash]On Behalf Of Simon Cozens Sent: 30 October 2002 11:37 To: ruby-talk ML Subject: Re: How do I get a '\'? "J.Hawkesworth" writes: > the memory stick but I can't find a way to get ruby to produce a single > '\' character (which I need for specifiying subdirectories). > > irb(main):041:0> p "\\" > "\\" You're being bitten by the fact that p uses inspect, and String.inspect gives you a "displayable" representation of a string that can be re-evalled back into ruby. "\\" does what you want: % ruby -e 'print "\\"' \ -- "If you want to travel around the world and be invited to speak at a lot of different places, just write a Unix operating system." (By Linus Torvalds) ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Control Centre. For further information visit http://www.star.net.uk/stats.asp _____________________________________________________________________ Any views or personal opinions expressed within this email may not be those of Talis Information Ltd. The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited.