Skip to content

Instantly share code, notes, and snippets.

@jberger
Created January 21, 2013 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jberger/4587287 to your computer and use it in GitHub Desktop.
Save jberger/4587287 to your computer and use it in GitHub Desktop.
Data::Dumper + do for simple data storage
use Data::Dumper;
sub write_data {
my ($file, $data) = @_;
open my $fh, '>', $file or die "Couldn't open $file: $!";
print $fh Dumper $data;
}
sub read_data {
my ($file) = @_;
my $data = do $file;
die $@ if $@;
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment