Forum: Ruby read data embedded in a program

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Li C. (Guest)
on 2007-01-19 17:31
(Received via mailing list)
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)
Li C. (Guest)
on 2007-09-26 00:31
(Received via mailing list)
--- Daniel F. <removed_email_address@domain.invalid> wrote:

> There are two underscores.
>
> Dan


Thanks. Now it works.

Li
Daniel F. (Guest)
on 2007-09-26 00:34
(Received via mailing list)
There are two underscores.

Dan
Li C. (Guest)
on 2007-09-26 00:45
(Received via mailing list)
--- Daniel F. <removed_email_address@domain.invalid> wrote:

> There are two underscores.
>
> Dan


Thanks. Now it works.

Li
Li C. (Guest)
on 2007-09-26 00:52
(Received via mailing list)
--- Daniel F. <removed_email_address@domain.invalid> wrote:

> There are two underscores.
>
> Dan


Thanks. Now it works.

Li
This topic is locked and can not be replied to.