read data embedded in a program

C

chen li

Hi all,

I run a script copied from "the Ruby way" but it
doesn't work. Any comments?

Thanks,

Li

###script

DATA.each_line do |line|
puts line.reverse
end

_END_

line A
line B
line C


##screen output
ruby p352_data.rb
p352_data.rb:2: uninitialized constant DATA
(NameError)
Exit code: 1



____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
 
D

Daniel Finnie

There are two underscores.

Dan

chen said:
Hi all,

I run a script copied from "the Ruby way" but it
doesn't work. Any comments?

Thanks,

Li

###script

DATA.each_line do |line|
puts line.reverse
end

_END_

line A
line B
line C


##screen output
p352_data.rb:2: uninitialized constant DATA
(NameError)



____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,220
Messages
2,571,128
Members
47,744
Latest member
FrederickM

Latest Threads

Top