Skip to content

Instantly share code, notes, and snippets.

@msztolcman
Created March 9, 2013 19:20
Show Gist options
  • Save msztolcman/5125381 to your computer and use it in GitHub Desktop.
Save msztolcman/5125381 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Terse = 1;
$Data::Dumper::Indent = 1;
$Data::Dumper::Quotekeys = 1;
sub dmp { say &Dumper; };
=a
RESULTS:
uninitialized
size: 24
total_size: 24
after 1024**2
size: 1052712
total_size: 1052712
after $x = undef
size: 1052712
total_size: 1052712
after 1024**2
size: 1052712
total_size: 1052712
after undef ($x)
size: 40
total_size: 40
=cut
use Devel::Size qw(size total_size);
my $x;
say 'uninitialized';
say 'size: ', size ($x);
say 'total_size: ', total_size ($x);
$x = 'x'x 1024**2;
say 'after 1024**2';
say 'size: ', size ($x);
say 'total_size: ', total_size ($x);
$x = undef;
say 'after $x = undef';
say 'size: ', size ($x);
say 'total_size: ', total_size ($x);
$x = 'x'x 1024**2;
say 'after 1024**2';
say 'size: ', size ($x);
say 'total_size: ', total_size ($x);
undef ($x);
say 'after undef ($x)';
say 'size: ', size ($x);
say 'total_size: ', total_size ($x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment