in reply to How to use __DATA__ efficiently, help!

my $data = '';  # set to the empty string
do{ $data = $data . $_ } while (<DATA>);
Always initialize your variables.
  • Comment on Re: How to use __DATA__ efficiently, help!

Replies are listed 'Best First'.
Re^2: How to use __DATA__ efficiently, help!
by Anonyrnous Monk (Hermit) on Feb 09, 2011 at 20:10 UTC

    Actually, that wouldn't help here, as it's not the undefined $data that Perl is complaining about, but the undefined $_.