[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

read data embedded in a program

Li Chen

1/13/2007 2:19:00 AM

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...

1 Answer

Daniel Finnie

1/13/2007 2:31:00 AM

0

There are two underscores.

Dan

chen li wrote:
> 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...
>
>