Skip to content

Instantly share code, notes, and snippets.

Created November 22, 2013 07:55
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 anonymous/7596385 to your computer and use it in GitHub Desktop.
Save anonymous/7596385 to your computer and use it in GitHub Desktop.
An example of File::Map's map_anonymous used with Storable's freeze/thaw. Might be a crappy example.
#!/usr/bin/env perl
use warnings;
use strict;
use feature ':5.10';
use Data::Dumper;
use Storable qw(freeze thaw);
use File::Map qw(map_anonymous);
my @arr = ('hi', 'there');
my $frozenarr = freeze \@arr;
my $length = length $frozenarr;
map_anonymous my $map, $length, 'shared';
substr $map, 0, $length, $frozenarr;
say Dumper thaw $map;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment