Created
October 12, 2012 12:58
-
-
Save perlancar/3879084 to your computer and use it in GitHub Desktop.
quickly get the size of perl data structures from the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Devel::SizeMe qw(:all); | |
unless (@ARGV) { | |
print "Usage: $0 <data-def-in-perl> ...\n"; | |
print "Example: $0 '[1,2,3]' '{foo=>1}'\n"; | |
exit 1; | |
} | |
for (@ARGV) { | |
print "$_: "; | |
eval qq[print total_size($_), "\n"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample output: