# Read data embedded in a program

**URL:** <https://rubytalk.org/t/read-data-embedded-in-a-program/34420>\
**Category:** ruby-talk\
**Created:** [13 January 2007 02:19 UTC](https://rubytalk.org/t/read-data-embedded-in-a-program/34420 "2007-01-13T02:19:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guest2](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@Guest2](https://rubytalk.org/u/Guest2)\
**Post date:** [13 January 2007 02:19 UTC](https://rubytalk.org/t/read-data-embedded-in-a-program/34420/1 "2007-01-13T02:19:08Z")

</div>

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|  
&nbsp;&nbsp;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](http://new.mail.yahoo.com)

---

<div class="post-metadata">

**Author:** ![Daniel\_Finnie1](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@Daniel\_Finnie1](https://rubytalk.org/u/Daniel_Finnie1)\
**Post date:** [13 January 2007 02:30 UTC](https://rubytalk.org/t/read-data-embedded-in-a-program/34420/2 "2007-01-13T02:30:42Z")

</div>

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|  
> > &nbsp;&nbsp;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](http://new.mail.yahoo.com)

---

<div class="post-metadata">

**Author:** ![Guest2](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@Guest2](https://rubytalk.org/u/Guest2)\
**Post date:** [13 January 2007 02:34 UTC](https://rubytalk.org/t/read-data-embedded-in-a-program/34420/3 "2007-01-13T02:34:21Z")

</div>

Thanks. Now it works.

Li

> **···**
>
> --- Daniel Finnie \<danfinnie@optonline.net\> wrote:
> 
> > There are two underscores.
> > 
> > Dan
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Cheap talk?  
> Check out Yahoo! Messenger's low PC-to-Phone call rates.  
> [http://voice.yahoo.com](http://voice.yahoo.com)

---

<div class="post-metadata">

**Author:** ![Guest2](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@Guest2](https://rubytalk.org/u/Guest2)\
**Post date:** [13 January 2007 02:34 UTC](https://rubytalk.org/t/read-data-embedded-in-a-program/34420/4 "2007-01-13T02:34:29Z")

</div>

Thanks. Now it works.

Li

> **···**
>
> --- Daniel Finnie \<danfinnie@optonline.net\> wrote:
> 
> > There are two underscores.
> > 
> > Dan
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Finding fabulous fares is fun.  
> Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.  
> [http://farechase.yahoo.com/promo-generic-14795097](http://farechase.yahoo.com/promo-generic-14795097)

---

<div class="post-metadata">

**Author:** ![Guest2](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@Guest2](https://rubytalk.org/u/Guest2)\
**Post date:** [13 January 2007 02:34 UTC](https://rubytalk.org/t/read-data-embedded-in-a-program/34420/5 "2007-01-13T02:34:34Z")

</div>

Thanks. Now it works.

Li

> **···**
>
> --- Daniel Finnie \<danfinnie@optonline.net\> wrote:
> 
> > There are two underscores.
> > 
> > Dan
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> It's here! Your new message!  
> Get new email alerts with the free Yahoo! Toolbar.  
> [http://tools.search.yahoo.com/toolbar/features/mail/](http://tools.search.yahoo.com/toolbar/features/mail/)
