diff --git a/helloworld.pl b/helloworld.pl new file mode 100644 index 0000000..720dd1f --- /dev/null +++ b/helloworld.pl @@ -0,0 +1,18 @@ +use strict; +use warnings; +# Question: +# 这两行的含义? + +# Usage +die "perl $0 \n" if(@ARGV==0); +# Question: +# @ARGV==0 是啥意思? + +# 接收参数 +my($word) = @ARGV; +# Question: +# @ARGV是一个什么变量? + +print "hello $word\n"; +# Question +# print 的用法 diff --git a/operatePerl.pl b/operatePerl.pl index 23aa854..41a3251 100644 --- a/operatePerl.pl +++ b/operatePerl.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl +##Copyrigh (C) 2011 by linchao #Program: # 练习Perl的运算符 #2017/01/22 林超 First release diff --git a/regexPerl.pl b/regexPerl.pl index cc2660c..a80cd97 100644 --- a/regexPerl.pl +++ b/regexPerl.pl @@ -1,3 +1,4 @@ +#!usr/bin/perl -w =cut while(<>) { @@ -33,10 +34,19 @@ #s#.*#$1#g; print("Matched:|$`----$&-----$'|\n"); print($_); +# 小骆驼第九章第三题 +$^I = ".out"; +while(<>) +{ + s/print/!!!!!!!!!!!!!!!!!!!!/g; + s/#/print/g; + s/!!!!!!!!!!!!!!!!!!!!/#/g; + print($_); =cut +# 小骆驼第九章第四题 $^I = ".out"; while(<>) { - s/print/say/g; + s/(#!.*\n)/$1##Copyrigh (C) 2011 by Alice Zhao\n/g; print($_); } \ No newline at end of file diff --git a/varPerl.pl b/varPerl.pl index 5b4b1cd..c7b62ae 100644 --- a/varPerl.pl +++ b/varPerl.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl +##Copyrigh (C) 2011 by linchao #Program: # Perl变量练习 #2017/01/21 林超 First release diff --git a/varPerl.pl.out b/varPerl.pl.out deleted file mode 100644 index e69de29..0000000