From: J-H Johansen Date: 2011-06-29T06:27:48+09:00 Subject: Re: here docs: WTF am i doing wrong??? --000e0cd32bfabd01ca04a6cc56c5 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jun 28, 2011 at 11:17 PM, serialhex wrote: > ok, so i'm trying to create a here doc for a little program i'm writing and > it dosn't seem to want to work right! > > this code works: > ### > pry(main)> print < pry(main)* 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 > pry(main)* 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 > pry(main)* NUMS > 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 > 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 > => nil > ### > > but this: > ### > pry(main)> str = '' > => "" > pry(main)> str < pry(main)* 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 > pry(main)* 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 > pry(main)* NUMS > ### > > gives me: > ### > SyntaxError: (pry):43: Invalid octal digit > 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 > ^ > (pry):43: syntax error, unexpected tINTEGER, expecting $end > 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 > ^ > from > > /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:226:in > `eval' > ### > > so why can i 'print' a here doc, but not set it to a variable??? or am i > doing something stupid wrong that i dont know what i'm doing with the > stupid > and the wrongness?? (sorry, i think i need to catch up on some sleep too) > > any help is appreciated > hex > > Try this: irb(main):001:0> st = "" => "" irb(main):002:0> st << < "08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08\n" irb(main):005:0> > > -- > my blog is cooler than yours: serialhex.github.com > > > > Other than the fact Linux has a cool name, could someone explain why I > > > should use Linux over BSD? > > > > No. That's it. The cool name, that is. We worked very hard on > > creating a name that would appeal to the majority of people, and it > > certainly paid off: thousands of people are using linux just to be able > > to say "OS/2? Hah. I've got Linux. What a cool name". 386BSD made the > > mistake of putting a lot of numbers and weird abbreviations into the > > name, and is scaring away a lot of people just because it sounds too > > technical. > -- Linus Torvalds' follow-up to a question about Linux > -- Jens-Harald Johansen -- There are 10 kinds of people in the world: Those who understand binary and those who don't... --000e0cd32bfabd01ca04a6cc56c5--