From: Dave Thomas Date: 2000-03-06T21:43:28-06:00 Subject: [ruby-talk:01770] $stdin and DATA Was was trying to test a program that would normally read using Kernel#gets. Because I wanted the test to be self contained, I thought I'd include the test data in the file: while DATA.gets # ... end __END__ stuff... This worked fine. However, to make the changeover between test and production easier, I thought I'd be clever: $stdin = DATA while gets # ... end __END__ stuff... But this doesn't seem to work. Then, while playing with this, I discovered something equally strange: $stdin = DATA while DATA.gets # ... end __END__ stuff... Simply assigning DATA to $stdin stops the loop from working. Is there a way to do what I need - to have a plain 'gets' read from DATA? And is the above behavior expected? Regards Dave