摘要: hash和hash引用的常见操作方法如下:#init a hash my %hash = ();#init a hash reference my $hash_ref = {};# add a k... 阅读全文
posted @ 2018-01-07 22:21 小怪兽&奥特曼 阅读(159) 评论(0) 推荐(0)
摘要: 在perl函数传递过程中,我们有时候需要判断入参是hash类型,还是数组时,我们可以使用ref系统函数来判断,代码如下:my %hash =();my @arr = ();my $hash_ref... 阅读全文
posted @ 2018-01-07 21:35 小怪兽&奥特曼 阅读(123) 评论(0) 推荐(0)
摘要: #如果给定的值不是undef, defined()函数会返回 true #如果给定值是undef 则返回false.my $test01 = "" ;#it return ture it will... 阅读全文
posted @ 2018-01-07 16:34 小怪兽&奥特曼 阅读(282) 评论(0) 推荐(0)
摘要: 直接先上代码,看看示例一的实现:示例一:sub make_new_counter{ my $start = shift; #返回匿名函数 return sub{ ... 阅读全文
posted @ 2018-01-07 15:51 小怪兽&奥特曼 阅读(126) 评论(0) 推荐(0)
摘要: #encode the JSON result into UTF-8,$json = JSON->new->utf8;#验证 utf8 标志位print "utf8 flag: ",$json->... 阅读全文
posted @ 2018-01-07 10:26 小怪兽&奥特曼 阅读(376) 评论(0) 推荐(0)