Read data embedded in a program


#1

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)


#2

— Daniel F. removed_email_address@domain.invalid wrote:

There are two underscores.

Dan

Thanks. Now it works.

Li


#3

There are two underscores.

Dan


#4

— Daniel F. removed_email_address@domain.invalid wrote:

There are two underscores.

Dan

Thanks. Now it works.

Li


#5

— Daniel F. removed_email_address@domain.invalid wrote:

There are two underscores.

Dan

Thanks. Now it works.

Li