
Perl / Python
文章平均质量分 62
autofei
这个作者很懒,什么都没留下…
展开
-
Perl 学习心得体会
首先是在windows平台上使用,可以下载ActivePerl或者StrawberryPerl,安装后既可以像在linux下进行命令行运行了(没有图形界面,呵呵!)Predefined Names:http://www.cs.cmu.edu/People/rgs/pl-predef.htmlPerl 中的特殊变量 $&, $`,$ ,@_ :http://blog.youkuaiyun.com/bj原创 2008-05-19 00:30:00 · 1219 阅读 · 0 评论 -
Install Perl CPAN modules
You can go to http://search.cpan.org/ or use Google to find out the module. Make sure you get the name of the module.Update Perl CPAN Link:From the root prompt on your server, invoke the CPAN原创 2009-07-17 00:52:00 · 3219 阅读 · 0 评论 -
Perl中的grep和map
grep返回一个数字中符合条件的所有元素;map对数字中所有元素实施转化并返回结果。两者都遍历了数组,但一个用来搜索,一个用来转化。两者都支持表达式或者代码块。#!/usr/bin/perl -wuse strict;#get positive numbermy @num原创 2011-08-10 01:13:29 · 2740 阅读 · 0 评论 -
用Devel::NYTProf 优化perl脚本性能
前几天发一下一个脚本运行非常慢,使用time只能知道总的时间,却无法确认原因,发现Devel::NYTProf是个很不错的工具。如果你有root权限,则:perl -MCPAN -e shell>installJSON::Any(不安这个东东,在nyt生成html的时原创 2011-08-18 05:58:46 · 3664 阅读 · 0 评论 -
如何编写MapReduce代码
关于maperduce,可以参考:http://en.wikipedia.org/wiki/MapReduce这里假设你具备一定的hadoop编程经验。Mapper接受原始输入,比如网站日志,分析并输出中间结果。经历排序,分组成为Reducer的输入,经过统计汇总,输出结果。当然这个过程可以是多个。其中Mapper比较简单,但是需要对输入具有深入的理解,不光是格式还包括意义。其中有原创 2011-12-01 04:16:28 · 3728 阅读 · 0 评论 -
回调函数(callback)浅析
编程一段时间之后,都会或多或少的接触到“回调函数”的概念,我对这个概念的理解也是浅尝辄止,就此分享一些浅见。"软件模块之间总是存在着一定的接口,从调用方式上,可以把他们分为三类:同步调用、回调和异步调用。同步调用是一种阻塞式调用,调用方要等待对方执行完毕才返回,它是一种单向调用;回调是一种双向调用模式,也就是说,被调用方在接口被调用时也会调用对方的接口;异步调用是一种类似消息或事件的机制,不过原创 2011-12-17 03:19:37 · 3585 阅读 · 1 评论 -
Perl中的闭包(closure)
什么是闭包,“This is a notion out of the Lisp world that says if you define an anonymous function in a particular lexical context, it pretends to run in that context even when it's called outside of the con原创 2011-12-17 03:44:57 · 4216 阅读 · 0 评论