use Devel::Size qw< size total_size >; sub size_print($\$) { my ($name, $ref) = @_; printf "%20s %5d %5d\n", $name, size($ref), total_size($ref); } my $string = 'Long string' x 100; printf "%20s %5s %s\n", qw; size_print '$string', $string; my $collection = [ ]; size_print '$collection (empty)', $collection; push @$collection, \$string; size_print '$collection ( one )', $collection; push @$collection, \$string; size_print '$collection ( two )', $collection; __END__ Name size total_size $string 1134 1134 $collection (empty) 24 88 $collection ( one ) 24 1278 $collection ( two ) 24 1302