04 2012 档案

perl-CGI
摘要:你会写ASP的话,那就试试Mason。apache编译进mason处理器,也跟IIS + ASP一样,放上去就能运行。最简单的是CGI,放在apache的cgi-bin目录,什么都不用配置就可以运行。第一个CGI脚本:#!/usr/bin/perluse strict;use CGI;my $q=CGI->new;print $q->header;print "Hello world";复制代码上述脚本存成a.pl,放在cgi-bin目录,设置可执行chmod +x a.pl,然后从浏览器访问:http://xx.xx.xx.xx/cgi-bin/a.pl输出H 阅读全文

posted @ 2012-04-26 23:24 perlman 阅读(283) 评论(0) 推荐(0) 编辑

tr
摘要:see codes belowmy $str = 'abc';my $count = ( $str =~ tr/a-z/A-Z/ );print $count, "\n"; # How many chars were traslate: 3print $str, "\n"; # The traslated string: ABC== 阅读全文

posted @ 2012-04-26 10:47 perlman 阅读(207) 评论(0) 推荐(0) 编辑

插入文件到代码中
摘要:iab papp <Esc>:r ~/Perl/test.pl<CR><Up>dd<Esc>进入命令模式:r ~/Perl/test.pl<CR> 插入test.pl中的代码到当前光标处<Up>dd,上移光标并删除一行,前一条命令会产生一个空行 阅读全文

posted @ 2012-04-26 09:47 perlman 阅读(343) 评论(0) 推荐(0) 编辑

perl常见问题
摘要:1 local,my及our的区别2 use和require的区别3 -w, use warnings, ^W的区别,看perllexwarn4 ..与...的区别,看range operators5 q, qq, qr, qx 阅读全文

posted @ 2012-04-25 10:11 perlman 阅读(601) 评论(0) 推荐(0) 编辑

vim能映射命令么?
摘要:比如我想将1-10行注释掉,能不能设置这样一个快捷键?1,10 cc 表示comments,这样1-10行就全部加上#号了。 阅读全文

posted @ 2012-04-21 10:43 perlman 阅读(465) 评论(0) 推荐(0) 编辑

问号在正则表达式里的四种用途
摘要:原文问号,需要转义有无量词非贪婪修饰符不捕获前缀 阅读全文

posted @ 2012-04-20 17:23 perlman 阅读(757) 评论(0) 推荐(0) 编辑

use re 'debug' 可以查看正则表达式的匹配过程。
摘要:use strict;use warnings;use re 'debug';sub test { my $str = "123456789"; print join(":", split /(?<=...)/, $str);}test(); 阅读全文

posted @ 2012-04-20 12:56 perlman 阅读(465) 评论(0) 推荐(0) 编辑

用{}修饰变量名
摘要:用{}修饰变量名,可以防止 _ 被解释为变量名的一部分。sub test { my $head = "abc"; my $tail = "def"; my $full = "${head}_${tail}"; print $full, "\n";}直接写成下面这样,在strict模式下是无法通过的。my $full = "$head_$tail"; 阅读全文

posted @ 2012-04-20 12:44 perlman 阅读(479) 评论(1) 推荐(0) 编辑

perl 中的$a和$b
摘要:这两个变量是为sort函数准备的内置变量,所以声明的时候可以不加 my即使打开了strict和warnings选项也无妨,下面代码并无错误和警告。use strict;use warnings;sub test { $a = 1; $b = 2; print $a, "\n"; print $b, "\n";}test();1;from perldoc perlvarperldoc perlvar $a $b Special package variables when using sort(), see "sort" in ... 阅读全文

posted @ 2012-04-19 10:44 perlman 阅读(1022) 评论(0) 推荐(0) 编辑

perl函数原型
摘要:CU上的翻译=head1 prototype Perl 可以通过函数元型在编译期进行有限的参数类型检验。如果你声明 sub mypush (+@) 那么 mypush() 对参数的处理就同内置的 push() 完全一样了。函数声明必须要在编译 相应函数调用之前告知编译器(编译器在编译函数调用时会对相应函数用 prototype 来查询它的元型来进行参数检验,并决定怎样编译此函数调用)。元型只在不用 & 调用 函数的时候起作用。就是说在语法上如果你想像内置函数一样调用,它就表现的像 内置函数一样。如果想用过时的风格通过 & 调用,那么编译器就无视函数声明。另外 元型在函数引用如 阅读全文

posted @ 2012-04-16 12:32 perlman 阅读(2518) 评论(0) 推荐(0) 编辑

一个命令行交互脚本
摘要:按q键退出,否则显示用户输入。#! /usr/local/bin/perl5use strict;use warnings;sub test { while (1) { # display the prompt print "sditest> "; # Get input form STDIN, this is short for my $get = <STDIN> chomp (my $get = <>); # Quit when user pressed 'q', otherwise print what ever... 阅读全文

posted @ 2012-04-12 09:59 perlman 阅读(634) 评论(0) 推荐(0) 编辑

建站手册
摘要:Apache+php+mysql配置详解http://tech.163.com/06/0206/11/299AMBLT0009159K.html 阅读全文

posted @ 2012-04-09 09:24 perlman 阅读(192) 评论(0) 推荐(0) 编辑

Vim good pages
摘要:http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/ 阅读全文

posted @ 2012-04-09 09:00 perlman 阅读(225) 评论(0) 推荐(0) 编辑

scp的两种方式
摘要:如果host A 与 host B建立了信任连接(B有A的public key),那么从A向B传送文件,或者从B上传回文件都可以省略密码。但是前提是命令是在A上执行的。从A向B拷贝文件on host Ascp /tmp/file hostB:/home/users/tmp/file从B向A拷贝文件on host Ascp hostB:/home/users/tmp/file /tmp/file总结一下,如果B有A的public key,那么A与B通信皆可以省略密码,但是B与A通信仍需密码,因为A并没有B的public key. 阅读全文

posted @ 2012-04-04 19:00 perlman 阅读(588) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示