Read data embedded in a program

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)

— Daniel F. [email protected] wrote:

There are two underscores.

Dan

Thanks. Now it works.

Li

There are two underscores.

Dan

— Daniel F. [email protected] wrote:

There are two underscores.

Dan

Thanks. Now it works.

Li

— Daniel F. [email protected] wrote:

There are two underscores.

Dan

Thanks. Now it works.

Li

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs