
perl
王子力
星星之火,可以燎原
展开
-
perl多线程实例(四个线程同时读MYSQL数据库获取记录)
use threads; use DBI(); # input: # $_[0]: fruitname sub fetchFruit { # Connect to the database. my $dbh = DBI->connect("DBI:mysql:database=FruitDB;host=localhost",原创 2013-08-25 12:50:16 · 1447 阅读 · 0 评论 -
perl读文件第m到n行的实例
#!/usr/bin/perl use strict; use warnings; open (IN,"testdata.dat") or die; open (OUT,">>./someRN.txt") or die; my $i=1; while () { chomp; if ($i>=2&&$i<=4) { #..1000.2000........LZ........... pri原创 2013-09-09 23:00:54 · 3793 阅读 · 0 评论 -
perl regex 取一些匹配字符串
#!/usr/bin/perl use strict; use warnings; my @array; open(my $fh, "<", "file3") or die "Failed to open file: $!\n"; while() { chomp; push @array, $_; } close $fh; foreach my $line(@array)原创 2015-05-06 22:39:25 · 615 阅读 · 0 评论 -
perl regex 取一些匹配字符串
#!/usr/bin/perl use strict; use warnings; my @array; open(my $fh, "<", "file3") or die "Failed to open file: $!\n"; while() { chomp; push @array, $_; } close $fh; foreach my $line(@array)原创 2015-05-06 22:40:08 · 1248 阅读 · 0 评论