perl
iteye_15479
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
这几天coding的一些记录
今天写code一个体会就是写出好的SQL很重要。。。 1. 不要用not in,严重影响performance,用其他写法替代。2. 注意left join,join等区别。3. 。。。 还有就是perl的一个问题一个undef的值跟其他数值比较结果如何?比如 $var = undef;if($var <= 0){ print "here";}...原创 2011-05-21 15:03:31 · 119 阅读 · 0 评论 -
Serialize/Deserialize Perl Class Objects
Today in a small project I need to serialize a perl class object to string in order to cache it. And when getting back the value from the cache I need to deserialize it to original class objects. ...2013-06-18 14:09:16 · 131 阅读 · 0 评论 -
perl tips for qw qq qx q
q// is generally the same thing as using single quotes - meaning it doesn't interpolate values inside the delimiters.qq// is the same as double quoting a string. It interpolates.qw// return a list...2013-07-26 16:58:02 · 183 阅读 · 0 评论 -
怎样生成全排列?
我前面写过一种方法生成全排列,现在看用DP的方法解决。参考[url="http://standalone.iteye.com/blog/757948"]How to generate permutations[/url] 看前面的那种解法。DP的思路就是生成N个数的全排列,先考虑生成前面N-1个数字的全排列,然后把最后一个数字插入上一步每个结果的每个缝隙中,形成最后的结果。用pe...原创 2012-10-29 11:25:23 · 166 阅读 · 0 评论 -
perl的数组操作
[list][*][b]生成连续的一列数字或字母:[/b]my @numbers = (1..100);my @chars = (a..z);[*][b]添加或者删除元素[/b]shift: 移除数组的第一个元素;unshift: 添加一个元素到数组的最后;push: 添加一个元素到数组的第一个元素;pop:去除数组的最后一个元素。[ta...原创 2012-10-29 11:43:04 · 292 阅读 · 0 评论 -
找零钱问题
假设有25美分,10美分,5美分,1美分的硬币足够多,假设有N美分钱,问你怎么用这些硬币表示?用perl重新做这个问题,前面用[url="http://standalone.iteye.com/admin/blogs/1670164"]java[/url]做过[code="java"]use strict;use warnings;my $count = 0;s...原创 2012-10-29 15:59:42 · 168 阅读 · 0 评论 -
Perl的Getopt::Long 模块
处理perl参数的时候最有用的模块,有关使用具体细节参考以下别人的博客:[url]http://www.php-oa.com/2009/04/04/perl_getopt-long.html[/url]原创 2012-12-18 17:27:47 · 563 阅读 · 0 评论 -
Perl DBI 使用详解
每次使用DBI的时候都忘记该使用哪个函数,下面这个博客讲得很详细![url]http://blog.youkuaiyun.com/fan_zhen_hua/article/details/6078337[/url]原创 2012-12-18 18:32:52 · 270 阅读 · 0 评论 -
Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };
[url]http://www.perlmonks.org/index.pl?node_id=287647[/url]open FILEHANDLE, 'somefile.txt' or die $!;my $string = do { local $/; };The above idiom is a consise way to "slurp" the entire con...原创 2012-12-28 16:25:47 · 135 阅读 · 0 评论 -
How to invoke shell in perl and how to capture the error if any?
[url]http://www.perlmonks.org/?node_id=57193[/url]system("wc -l");Will call the given command and return the return value of that command. This is usually not what you want, because most of the ...2013-01-11 16:08:31 · 135 阅读 · 0 评论 -
prepare or prepare_cached
If you are also confused about what benefits prepare_cached will bring to you like me, please read this article.[url]http://gssg-www.stanford.edu/public/preparecached.html[/url]原创 2012-08-23 10:52:16 · 154 阅读 · 0 评论 -
Passing a regex pattern as a varaible in perl?
Look at this example: [url]http://stackoverflow.com/questions/125171/passing-a-regex-substitution-as-a-variable-in-perl[/url]原创 2012-08-02 12:10:08 · 96 阅读 · 0 评论 -
Perl的our变量
看了一下下面这篇文章,理解了our变量的意思。[url]http://www.chinaunix.net/jh/25/556778.html[/url]原创 2012-04-19 15:37:24 · 272 阅读 · 0 评论 -
别人总结的perl技巧
1. 用eval获得程序的执行错误$a = 10;$b = 0;$c = $a/$b;会发生什么?程序会crash,因为有浮点数异常。用eval就可以做到两全,既执行语言,又能在出现异常的时候不crash$a = 10;$b = 0;eval {$c = $a/$b};eval { ... }可以捕获执行的多条语句的错误结果。然后用$@可以得到错误原因。...原创 2011-05-21 15:08:33 · 150 阅读 · 0 评论 -
data types in perl
built-in data types: scalar: int, string, referencearrayhash2009-09-21 18:52:27 · 112 阅读 · 0 评论 -
Fiel Test in Perl
http://www.devshed.com/c/a/Perl/File-Tests-in-Perl/ File test in perl is quite useful. E.g., how to check if a file exists? How to check if it's writable? And how to get age of a file? I fin...原创 2011-09-06 13:06:50 · 142 阅读 · 0 评论 -
executing external commands in perl
http://www.perlhowto.com/executing_external_commands原创 2011-09-06 15:00:14 · 115 阅读 · 0 评论 -
How to read command-line arguments with Perl
Submitted by alvin on August 9, 2009 - 8:41pmtags: args arguments argv command line perl perl read source code Perl command line FAQ: How do I read command-line arguments with Perl (command lin...原创 2010-07-29 09:58:09 · 120 阅读 · 0 评论 -
Regular Expression: Greedy and Non-Greedy Quantification
1 my $string = '"hello there", said Pooh, "how are you today?". I said "brilliant!".'; 2 print "$string\n"; 3 $string =~ s/('|")(.*?)\1/$1.uc($2).$1/ge; 4 print "$string\n"; I want to.原创 2011-04-12 11:25:50 · 204 阅读 · 0 评论 -
Perl POE
http://www.php-oa.com/2009/09/09/perl-poe-1.html原创 2011-04-15 10:50:44 · 194 阅读 · 0 评论 -
send html with perl MIME:Lite
Today I encounter a problem when sending html content via Perl's MIME:Lite, in my html there is always a </tr> got broken...damn it! I checked the html string, it's all right. Finally I foun...2011-10-28 15:35:34 · 258 阅读 · 0 评论 -
perl单元测试
这个文章讲得很好。[url]http://perlmeme.org/tutorials/writing_test_harness.html[/url]原创 2012-04-19 15:13:50 · 156 阅读 · 0 评论 -
Date/Time处理函数总结 [To Do]
几种我所用到的用来处理日期,时间的函数总结。[u][b]Perl[/b][/u]1. localtime[code="perl"] # 0 1 2 3 4 5 6 7 8 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);[/code]I...原创 2013-04-12 10:46:39 · 353 阅读 · 0 评论
分享