
Perl
文章平均质量分 66
ThinkHY
好读书,喜编码,以构建软件为乐。
展开
-
聆听大师---Perl发明人及开源软件先锋Larry Perl
学习和使用#Perl#多年,今天终于有幸在Perl Workshop见到了Perl的发明人Larry Wall。Larry对50年代到现今各种编程语言的设计哲学信手捻来,其中有吐槽有爆料,会场里笑声迭起;还娓娓道来开源社区的协作方式:不做dictator,讲究empathy; 在Q&A和demo环节也感受了Larry对于Perl6的期许与passion。 另外,在Q&A环节中,有之前在线提出三原创 2014-04-07 22:21:39 · 3279 阅读 · 0 评论 -
What's the difference between “local” and “my” in Perl
There are two kinds of variable scopes in Perl:Global variables: They reside in the current package, can be accessed from the outside and can have "local" values. The name can be used as a key原创 2012-08-30 12:55:13 · 1779 阅读 · 0 评论 -
An easy way to track state of network connection using Perl
Tonight, just paste some code here. I'll comment these code when I'm free.https://gist.github.com/33050558/11/2012 UpdateBackgroundUnix Shell can be timed out after setting a enviro原创 2012-08-09 23:17:49 · 1054 阅读 · 0 评论 -
A DEMO script on how to use CPAN module HTML::LinkExtor
Last week I got a large book "Perl Cookbook". It mentions an useful module HTML::LinkExtor in the book, seems handy to use. Right now, I just wanted to crawl some docs from MVS-OE archive webpage, so原创 2012-06-23 12:32:26 · 874 阅读 · 0 评论 -
[经验总结]Perl提取网页信息
#!/usr/bin/perl -w# Gist: https://gist.github.com/2928006use LWP::Simple;my $url=$ARGV[0];my $filename =$ARGV[1]; my $content = get($url) or die "Couldn't get $url";#$content =~ s#^.*?().*$##原创 2010-07-10 23:44:00 · 2545 阅读 · 5 评论 -
为什么要用CPAN
刚在水木Python版上看到一贴,深以为然,遂贴之。 python有类似perl的cpan的东西吗 ?弱问一下,google了一下没找到精确答案--------------------------------------------------------------------------------------像cpan那么完善的是没有的。官方的pypi有点类似,但是差很多原创 2010-12-30 21:05:00 · 1261 阅读 · 1 评论 -
在文件中查找文本的Perl脚本
Windows里没有grep工具,不方便对文件的内容进行查找,随手写了一个Perl脚本,脚本写得不是很简洁,但能工作。Github: https://gist.github.com/2273079#!/usr/bin/perl -w#############################################################原创 2012-04-01 15:57:51 · 3057 阅读 · 0 评论 -
最近的一次Perl Session
最近部门里有两个团队里需要用到Perl, 但几乎没有人接触Perl这个奇怪的语言。 很凑巧,我在闲聊中透露了自己是Perl爱好者,于是就被叫过去给同事们做一个介绍性质的session。 我只是个Perl初学者,但考虑到Perl还是给我带来了很多乐子,我也想尝试推广Perl,让同事了解Perl,同时感受快乐。 所以,不谦虚的接受了这个邀请。 还好还好,同事们给了我一周的时间准备,中间还隔了一个周末。原创 2012-03-03 23:27:35 · 1456 阅读 · 0 评论 -
Understand Perl's References
Understand References Today© Copyright 1998 The Perl Journal. Reprinted with permission.One of the most important new features in Perl 5 was the capability to manage complicated data structures li转载 2011-12-29 22:02:07 · 820 阅读 · 0 评论 -
Perl Module : How to Install Perl Module on Windows
The most simple task to make your tasks simpler is installing a perl module on your machine.There are three common ways by which one can install a perl module on your machine. Lets see the insta转载 2012-02-02 10:54:37 · 1890 阅读 · 0 评论 -
Do you still program in Perl?
Notice a great post on reddit, the author listed some useful modules in it. I am excited for that Perl community always appears to be full of vitality and innovation that surprise us.Below content i转载 2012-06-17 16:02:39 · 770 阅读 · 0 评论 -
How can convert character “%xx” in html using Perl
Submitted a question on StackOverflow just now. I intended to extract content from a web page which contains many unicode characters represented in the form of "%xx". As I used Perl module LWP to原创 2012-08-27 23:20:51 · 1580 阅读 · 0 评论 -
TED字幕下载工具的使用方法
之前用过N种方法下载TED字幕,现在都已失效。无奈之下 在5.1期间DIY了一个Perl脚本,之前的博客有过介绍。这两天有网友问我用法,总结一下,如下:下载地址:https://github.com/di3du/DisanduAdmin/raw/master/2012/tedSubtitle.zip源代码:https://github.com/di3du/DisanduAd原创 2011-06-23 21:17:00 · 11666 阅读 · 25 评论 -
Handy Notes for 2013 Beijing Perl Workshop
Yesterday I joined Beijing Perl Workshop and met lots of friends again, Joe, Roger, Qiang .... Below are my casual notes for yesterday's sessions. Just put it at here for memory.---------------原创 2013-08-11 11:16:04 · 3143 阅读 · 0 评论 -
TED演讲字幕下载脚本的使用方法
有朋友反映TEDHelper1.1已经不能使用,想试用TED字幕下载脚本,不过我现在老家休假,手头上只有适用于win7平台的打包工具。为保证脚本的正常使用,这里介绍一个较通用的方法。 这个方法稍微有些费劲,但无Windows版本的局限性,具体操作过程如下: STEP1: 下载安装Strawberry, .http://strawberry-perl.googlecode原创 2012-01-27 21:20:53 · 4382 阅读 · 4 评论 -
Use Perl to Kill Lotus Notes Processes on Windows
# Recently, I experienced Notes crash problems several times. # It wasted me a lot of time to terminate Notes completely and then restart it, # so I wrote this Perl script to save myself. Also hope it原创 2013-05-03 17:53:18 · 2474 阅读 · 0 评论 -
A handy Perl script to calculate duration in seconds
#!/usr/bin/perluse strict;use warnings;use DateTime;my $dt2 = DateTime->new( year => 2013, month => 8, day =>原创 2013-03-08 17:24:02 · 2338 阅读 · 0 评论 -
Three ways to use Perl to open a temporary file
Here I'll summarize three ways to open a temporary file using Perl. The first way is to create the new object via module IO::File to get a read/write file handle as below. my $temp_fh = IO:原创 2013-01-04 23:37:42 · 2615 阅读 · 0 评论 -
Exercise for Chapter 7 of "Intermediate Perl"
########################################################################## Brief: Exercise for Chapter 7 of "Intermediate Perl"# File: ch7_exam.pl# Creator: thinkhy# Date: 12/23/2012##############原创 2012-12-23 12:31:32 · 2516 阅读 · 0 评论 -
Convert transcript from Youtube format to SRT format
Recently I have been learning an operating system online course, UCBerkley CS 162. I read lecture on Youtube, but it's stuck sometimes, so I tried to download it directly. However, firstly it seem原创 2012-11-17 17:10:36 · 2760 阅读 · 0 评论 -
Two things need to note for unpack in Perl
In item 116 of the book "Effective Perl", author demonstrates how to use unpack to process fix-width columnar data. I tried to write a toy code for practice, and found two things need to note.Fi原创 2012-10-28 09:47:49 · 2380 阅读 · 0 评论 -
[新技术]Perl写的灌水机(转载)
#!perl# Demonstrate the programming using OLE with Perl # earn money at eetop.cn/bbs# By Alan# 2010-05-15use warnings;use strict;use Data::Dumper;use Win32::OLE qw( EVENTS ); my $time;$|=1;open LOG,">原创 2010-05-21 23:02:00 · 1418 阅读 · 3 评论 -
Perl的特殊变量
原作者:Dave Cross翻译者:sql (http://www.s8s8.net)正文让你的perl代码看起来更像perl代码,而不是像C或者BASIC代码,最好的办法就是去了解perl的内置变量。perl可以通过这些内置变量可以控制程序运行时的诸多方面。本文中,我们一起领略一下众多内置变量在文件的输入输出控制上的出色表现。行计数我决定写这篇文章的一个原因就转载 2012-01-09 22:56:54 · 680 阅读 · 0 评论 -
Web Basics with LWP
转自: http://www.perl.com/pub/2002/08/20/perlandlwp.htmlSean M. Burke is the author of Perl & LWPIntroductionLWP (short for "Library for WWW in Perl") is a popular group of Perl modules for accessing data on the Web. Like most Perl module-distributions, each转载 2010-08-15 09:19:00 · 1220 阅读 · 0 评论 -
[经验总结]Perl模块使用 => 简短例子代码集合
<br />[原创] Perl模块使用 => 简短例子代码集合!http://www.chinaunix.net 作者:deathcult 发表于:2003-09-04 14:59:54【发表评论】 【查看原文】 【Perl讨论区】【关闭】<br />如果你有模块使用范例(请尽量简洁),请帖新贴, <br />或坛内邮件(主题:perl模块使用范例)给我,由我测试 <br />整理以后,在此发布。 <br />希望多多支持! <br /><br />真心希望朋友们能在chinaunix受益。大家共同进步!转载 2010-07-22 23:17:00 · 2622 阅读 · 0 评论 -
[活动]北京 PerlChina 七月聚会
下午去五道口的蚂蚁咖啡红酒吧参加了七月份的Perl聚会,之前还是去年九年参加了Perl Workshop,那也是第一次真正接触Perl,之后用Perl写过一些小脚本,今年还用Perl做了一个数据转换的项目。近期订阅了PerlChina的邮件组,天天看大家讨论Perl种种话题,心生向往,这次看到邮件组时能通知就去参加了。这次聚会安排如下: agentzh - pack/unpack 实现简单的 TCP 协议的客户 - 聊一下使用 Perl 做测试 (40分钟) joe - DBI 灵活使用,原创 2010-07-10 18:21:00 · 993 阅读 · 0 评论 -
[经验总结]Perl读取Excel数据并调用MSXML接口操作XML数据
################################################################################################################################## File: excel.pl# Desscription: Perl读取Excel文件# Create: Think原创 2010-05-09 23:33:00 · 2019 阅读 · 0 评论 -
[技术学习]我的第一个Perl程序
#! f:/perl/bin/perl.exe – w################################################### 之前折腾过Python,很不适应其过于死板的风格,# 直到开始学习Perl,我才感觉到作为程序员的自由。# Perl也许不优美,但如同VIM一般,它能成为创造力之源原创 2010-01-06 22:59:00 · 958 阅读 · 0 评论 -
[技术学习]Perl正则表达式(转载)
1,定界符 =~ m/there/; =~ s/there/here/; 还有类型的定界符: =~ /there/ =~ m#there#; =~ s#there#here#; =~ m(there); =~ s(there)(here); =~ m{there};转载 2010-01-07 23:44:00 · 1034 阅读 · 0 评论 -
[经验总结]Perl输出csv文件
#!/usr/bin/perl -w # File: getinfo.pl # Creator: thinkhy # Usage: ./getinfo path outputfile # Date: 2010年 03月 07日 星期日 15:23:18 CST # 回复梁同学的需求,写了个Perl脚本来实现功能: #ubuntu系统原创 2010-03-07 15:18:00 · 5571 阅读 · 0 评论 -
[技术学习] CPAN::WordPress:XMLRPC折腾记录
<!--body { color: #000; background-color: #fff; margin: 0px 10%; min-width: 720px; font-family: Verdana, sans-serif; counter-reset: chapter section subsection subsubsection paragraph lchapte原创 2010-01-24 10:48:00 · 3276 阅读 · 0 评论 -
[技术学习]深入浅出之正则表达式(转载)
深入浅出之正则表达式前言: 半年前我对正则表达式产生了兴趣,在网上查找过不少资料,看过不少的教程,最后在使用一个正则表达式工具RegexBuddy时发现他的教程写的非常好,可以说是我目前见过最好的正则表达式教程。于是一直想把他翻译过来。这个愿望直到这个五一长假才得以实现,结果就有了这篇文章。关于本文的名字,使用“深入浅出”似乎已经太俗。但是通读原文以后,觉得只有用“深入浅出”才转载 2010-01-24 10:37:00 · 966 阅读 · 1 评论 -
[经验总结]解决Perl读取utf-8编码文件的问题
<br /> <br /> <br />一段Perl代码,放到Windows平台上就输出乱码,刚在网络上找到下面两行代码,解决了乱码问题:<br /> <br />use encoding 'gbk';<br />use open IN=>':encoding(utf8)';<br /> <br />还是Linux系统省事,utf-8大一统了。<br /> <br />原创 2010-08-29 20:24:00 · 1987 阅读 · 0 评论 -
清空.svn目录的Perl脚本
#!/usr/bin/perluse File::Path; use strict;use warnings;my @tree=;foreach (@tree){ &if_a_tree($_);}sub if_a_tree{ if(-d && $_ ne "." && $_ ne ".."){ print "$_ is a directory/n"; if ($_ eq ".svn") { rmtr原创 2011-02-28 16:15:00 · 868 阅读 · 0 评论 -
The Perls of 2011
The Perls of 2011Following my 2010 post, I thought I should register some of the great things that happened in the Perl programming world in 2011. Only this time instead of turning it into转载 2012-01-09 21:22:29 · 2296 阅读 · 0 评论 -
Just a Crawler
use strict;use WWW::Mechanize;use HTTP::Cookies;###go to login page and login.#my $url = 'https://www.google.com/accounts/ServiceLogin?hl=en&service=finance&nui=1&continue=http%3A%2F%2Ffinance.google.原创 2011-11-08 23:37:33 · 880 阅读 · 0 评论 -
用Perl实现网站自动登录
#!/usr/bin/perl -w use strict;use LWP;use HTTP::Request::Common qw(POST GET); use HTTP::Cookies;use LWP::UserAgent; use LWP::Simple; use URI::URL;my $ua原创 2011-11-07 22:38:58 · 3315 阅读 · 2 评论 -
在Windows平台安装Perl运行环境
之前在Windows平台一直用ActivePerl开发Perl应用,这一阵考虑到ActivePerl为商业软件,存在版权上的风险,准备换了一个开源的Perl运行环境。上网搜索到一款开源软件 :StrawBerry(http://strawberryperl.com/)。原创 2011-10-02 11:05:56 · 7088 阅读 · 2 评论 -
TedSubtitle Release Report
TedSubtitle Download: http://www.disandu.com/download/tedSubtitle.rarDescription: Get ted talk's subtitle from TED.com and conve原创 2011-09-11 22:51:19 · 1835 阅读 · 0 评论 -
A perl script for XSLT using MSXML
Last version: https://gist.github.com/1053576sub TransformWithArgs { my ($xsltFile, $xmlFile, $argsHash) = @_; my $template= Win32::OLE->new(MSXML2.XSLTemplate.4.0) or die "Couldnt crea原创 2011-06-27 22:26:00 · 1176 阅读 · 0 评论