随笔分类 -  Perl

摘要:In this article, let us discuss how to write Perl socket programming using the inbuilt socket modules in Perl.Perl socket modules provides an object i... 阅读全文
posted @ 2014-07-16 17:54 vigarbuaa 阅读(908) 评论(0) 推荐(0)
摘要:业务需要针对某文件进行判重操作,用Perl实现如下#!/usr/bin/perlmy %h;s/\s+$// and $h{$_}++ while ;print "$_ $h{$_}\n" for sort { $h{$b} $h{$a} } keys %h;使用效果, 打印出每种行数据的重复次数,例如用它来统计一下弱密码使用频度[admin@centos bin]$ perl checkRepeat.pl a | more123456789 23503212345678 21275111111111 76346dearbook 4590200000000 34953123 阅读全文
posted @ 2013-12-25 16:01 vigarbuaa 阅读(467) 评论(0) 推荐(0)
摘要:http://hellosa.blog.51cto.com/2698675/572004http://www.ibm.com/developerworks/cn/linux/sdk/perl/culture-8/ 阅读全文
posted @ 2013-05-30 17:35 vigarbuaa 阅读(219) 评论(0) 推荐(0)
摘要:Installing Wordnet::Similarity on WindowsToday I had the task of getting Wordnet::Similarity working for a project I'm involved in. Getting it to work on Windows is not straight forward, there appears to be a makefile issue Wordnet::QueryData.Here's a quick guide for those of you who don' 阅读全文
posted @ 2013-03-26 13:31 vigarbuaa 阅读(373) 评论(0) 推荐(0)
摘要:$cond =~ s/\[COL\:([\w_]+)\]/\$\$phash_msg\{\"$1\"\}/ig;my %hashMessage = $oldMsg =~ /(\w+)=\'([^\']*)\'/g;perl -e "print crypt ('blah','iv');" 阅读全文
posted @ 2012-11-28 17:57 vigarbuaa 阅读(151) 评论(0) 推荐(0)
摘要:在论坛上看到的,觉得蛮实用,总结出来分享一下[Windows版]:在_vimrc中做一个键的映射,map <SPACE>t <ESC>:!perl %<CR>将"空格 + t" 映射成调试perl程序的动作,这样可以不必退出Perl即运行程序如图:[Linux版]:用 Ctrl-z 然后向上方向键调出历史命令,然后 fg 恢复 vim 阅读全文
posted @ 2012-09-22 15:30 vigarbuaa 阅读(479) 评论(0) 推荐(0)
摘要:Perl中的@INC变量用于指定Perl module的查找路径。如:$VAR1 = '../lib';$VAR2 = '/opt/perl/lib/5.8.3/sun4-solaris-thread-multi';$VAR3 = '/opt/perl/lib/5.8.3';$VAR4 = '/opt/perl/lib/site_perl/5.8.3/sun4-solaris-thread-multi';$VAR5 = '/opt/perl/lib/site_perl/5.8.3';$VAR6 = '/op 阅读全文
posted @ 2012-08-28 13:03 vigarbuaa 阅读(1015) 评论(0) 推荐(0)
摘要:刚查了一下Time::HiRes的用法:它一般用来确定运行某个任务的所需的时间。 如: use Time::HiRes qw(gettimeofday tv_interval); my $start_time = [gettimeofday]; my $counter=0; foreach (1..1000){ $counter++; } my $interval=tv_interval($start_time,[gettimeofday]); print “it take the time :... 阅读全文
posted @ 2012-08-06 14:07 vigarbuaa 阅读(1337) 评论(0) 推荐(0)