Skip to content

Instantly share code, notes, and snippets.

@rjattrill
Created June 5, 2013 03:01
Show Gist options
  • Save rjattrill/5711324 to your computer and use it in GitHub Desktop.
Save rjattrill/5711324 to your computer and use it in GitHub Desktop.
Read a data structure in __DATA__ back into a variable.
use strict;
use warnings;
use v5.10;
use Data::Dump qw(dump);
my $var;
while (<DATA>) {
$var .= $_;
}
my $hr = eval $var;
say "hr: " . dump $hr;
__DATA__
[
{
key => 'value'
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment