随笔分类 -  Perl

摘要:#! /usr/bin/perl use strict; use warnings;#my @strict_pragma = qw ( a b c);#print $strict_pragma[0];print "\n _delimiter_match_http:// \n";$_ = "https 阅读全文
posted @ 2019-07-04 14:12 books2read 阅读(345) 评论(0) 推荐(0)
摘要:#! /usr/bin/perl use strict; use warnings;print "\n _substitutions_with_s/// \n";$_ = "He's out bowling with Barney tonight.";s/Barney/Fred/;print $_. 阅读全文
posted @ 2019-07-04 13:30 books2read 阅读(267) 评论(0) 推荐(0)
摘要:Regex of Perl: ?= 指的是如果后面匹配到,则后面的内容不做替换,保留。 ab, s/a?=b/x/,变为xb,即后面匹配到b,b保留不做替换 阅读全文
posted @ 2019-07-04 10:08 books2read 阅读(267) 评论(0) 推荐(0)
摘要:Perl:正则中问号的四周用途:1.字面意义的问号 2. 量词 3. 表示非贪心的修饰符 4.用以表示不具有记忆功能的圆括号 非贪心:在量词后面加?即可 阅读全文
posted @ 2019-07-03 16:03 books2read 阅读(469) 评论(0) 推荐(0)
摘要:要把下面文件的内容改了, Program name: graniteAuthor: Gilbert BatesCompany: RockSoftDepartment: R&DPhone: +1 503 555-0095Date: Tues March 9, 2004Version: 2.1Size: 阅读全文
posted @ 2019-07-03 15:08 books2read 阅读(1049) 评论(0) 推荐(0)
摘要:89 open FILE, "< file_4_ex_ch7.txt" 90 or die "cannot open file: $!"; 91 my $lines = join '', <FILE>; 92 print $lines."\n"; 93 $lines =~ s/^/file_4_ex 阅读全文
posted @ 2019-07-03 11:18 books2read 阅读(239) 评论(0) 推荐(0)
摘要:Perl:只是把“^”作为匹配的单字:只是匹配每一行的开头 $lines =~ s/^/file_4_ex_ch7.txt: /gm; 阅读全文
posted @ 2019-07-03 11:17 books2read 阅读(333) 评论(0) 推荐(0)
摘要:48 print @globbing."\n"; 输出: 3 阅读全文
posted @ 2019-07-02 16:04 books2read 阅读(184) 评论(0) 推荐(0)
摘要:正则表达式中 /s 可以帮助“.”匹配所有的字符,包括换行,从而实现【\d\D】的功能 阅读全文
posted @ 2019-07-02 11:22 books2read 阅读(525) 评论(0) 推荐(0)
摘要:123 $_ = "beforematcha? fter"; 124 if(/\b\w+a\b/){ 125 print "matched: <$`><$&><$'>|\n"; 126 } if(/a\b/) 这样的模式匹配也行,\b是单词边界锚点,即以a结尾的单词都可以匹配到 阅读全文
posted @ 2019-07-01 16:31 books2read 阅读(506) 评论(0) 推荐(0)
摘要:print '$`'."\n";print '$&'."\n";print $'."\n"; 输出: $`$& 而直接输出($`)的话就是变量值,即相符段落的前置字符会存到这里。输出‘$`’ 就变成标量值了 阅读全文
posted @ 2019-07-01 13:36 books2read 阅读(475) 评论(0) 推荐(0)
摘要:$ref = \%hash_clomnname_linevalue; $hash_of_whole_table{$table_name} = {%$ref}; 阅读全文
posted @ 2019-06-25 14:00 books2read 阅读(966) 评论(0) 推荐(0)
摘要:@hash_clomnname_linevalue{@column_name} = @column_values_of_each_line; #2 list compose a hash (for Jason) 阅读全文
posted @ 2019-06-25 10:08 books2read 阅读(264) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/fangwei1235/article/details/8570886 首页 博客 学院 下载 论坛 APP 问答 商城 活动 VIP会员 招聘 ITeye GitChat 图文课 写博客 消息 登录注册 首页 博客 学院 下载 论坛 APP 问答 商城 阅读全文
posted @ 2019-06-24 17:13 books2read 阅读(738) 评论(0) 推荐(0)
摘要:代码: 5 my $aref= [ 1,"foo",undef,13 ]; 6 print @$aref[0]."\n"; 7 print @$aref[1]."\n"; 8 print @$aref[3]."\n"; 输出: 1foo13 阅读全文
posted @ 2019-06-24 10:53 books2read 阅读(206) 评论(0) 推荐(0)
摘要:jimyokl has asked for the wisdom of the Perl Monks concerning the following question: Reputation: 5 Edit I just started learning Perl for several days 阅读全文
posted @ 2019-06-20 20:29 books2read 阅读(291) 评论(0) 推荐(0)
摘要:$tar xvfz JSON.tar.gz $cd JSON $perl Makefile.PL $make $make install 阅读全文
posted @ 2019-06-20 17:36 books2read 阅读(1967) 评论(0) 推荐(0)
摘要:bash-2.03$ ./u_json.pl Can't locate object method "encode" via package "JSON" at ./u_json.pl line 24. bash-2.03$ ./v_hash_2_Jason.pl Can't call method 阅读全文
posted @ 2019-06-20 17:04 books2read 阅读(311) 评论(0) 推荐(0)
摘要:54 while($lines_num_of_whole_table>=1){ 55 my $i = 1; 56 print "i:".$i."\n"; 57 @column_values_of_each_line = split(/,/, $table_column_name_and_value_ 阅读全文
posted @ 2019-06-20 14:04 books2read 阅读(397) 评论(0) 推荐(0)
摘要:Perl语言入门: 斜线不是元字符,所以在不作为分隔符时不需要加上反斜线。 阅读全文
posted @ 2019-06-19 14:31 books2read 阅读(295) 评论(0) 推荐(0)

Total Visits
AmazingCounters.com