in reply to package and do

The following is even simpler:
my $pkg = 'Foo'; my $foo = do { local $/; eval "<${pkg}::DATA>" };

The following is a version that doesn't use eval EXPR (faster, safer):

my $pkg = 'Foo'; my $data_fh = do { no strict 'refs'; *{"${pkg}::DATA"} }; my $foo = do { local $/; <$data_fh> };

And if you want to cut your memory usage in half, use the following:

my $pkg = 'Foo'; my $data_fh; { no strict 'refs'; $data_fh = *{"${pkg}::DATA"}; } my $foo; { local $/; $foo = <$data_fh>; }

You could even combine the two blocks.