I belive the solution to your problem is much simpler than implied in most of these posts. They all point out ways to accomplish what your code is trying to do, but they seem to miss what you are trying to do with your code. My solution? Read __DATA__ into a package variable, and have your subs act on it, and not try to read it inside of the sub itself.
Package:
package Foo;
use strict;
my $data;
{
local $/;
$data = <DATA>;
}
sub foo{
return $data;
}
__DATA__
Foo
Bar
Baz
Calling Code:
use Foo;
print $Foo::foo;
The above prints:
Foo
Bar
Baz