Skip to content

Commit

Permalink
完成正则表达式
Browse files Browse the repository at this point in the history
  • Loading branch information
pobin6 committed Feb 6, 2017
1 parent 4573831 commit 6f8b604
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
18 changes: 18 additions & 0 deletions helloworld.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use strict;
use warnings;
# Question:
# 这两行的含义?

# Usage
die "perl $0 <word>\n" if(@ARGV==0);
# Question:
# @ARGV==0 是啥意思?

# 接收参数
my($word) = @ARGV
# Question:
# @ARGV是一个什么变量?

print "hello $word\n";
# Question
# print 的用法
1 change: 1 addition & 0 deletions operatePerl.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/perl
##Copyrigh (C) 2011 by linchao
#Program:
# 练习Perl的运算符
#2017/01/22 林超 First release
Expand Down
12 changes: 11 additions & 1 deletion regexPerl.pl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!usr/bin/perl -w
=cut
while(<>)
{
Expand Down Expand Up @@ -33,10 +34,19 @@
#s#<a>.*</a>#$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($_);
}
1 change: 1 addition & 0 deletions varPerl.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/perl
##Copyrigh (C) 2011 by linchao
#Program:
# Perl变量练习
#2017/01/21 林超 First release
Expand Down
Empty file removed varPerl.pl.out
Empty file.

0 comments on commit 6f8b604

Please sign in to comment.