Chinaunix首页 | 论坛 | 博客
  • 博客访问: 841237
  • 博文数量: 253
  • 博客积分: 6891
  • 博客等级: 准将
  • 技术积分: 2502
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-03 11:01
文章分类

全部博文(253)

文章存档

2016年(4)

2013年(3)

2012年(32)

2011年(184)

2010年(30)

分类: Python/Ruby

2011-10-24 10:01:01

to visualize a complex data structure rapidly is to dump it.
  1. use Data::Dumper;

  2. my %total_bytes;
  3. while (<>) {
  4.   my ($source, $destination, $bytes) = split;
  5.   $total_bytes{$source}{$destination} += $bytes;
  6. }

  7. print Dumper(\%total_bytes);

  1. myhost% perl bytecounts2 <bytecounts-in
  2. $VAR1 = {
  3.           'thurston.howell.hut' => {
  4.                                      'lovey.howell.hut' => 1250
  5.                                    },
  6.           'ginger.girl.hut' => {
  7.                                  'maryann.girl.hut' => 199,
  8.                                  'professor.hut' => 1218
  9.                                },
  10.           'professor.hut' => {
  11.                                'gilligan.crew.hut' => 1250,
  12.                                'lovey.howell.hut' => 1360
  13.                              }
  14.         };


阅读(699) | 评论(0) | 转发(0) |
0

上一篇:debugger perl -d

下一篇:YAML

给主人留下些什么吧!~~