#!/usr/bin/perl -w
#use strict;
my $dir="/perl_case";
$dir=$dir."/";
my $filename="test0823.txt";
my $keysword="ccc:";
my $count="10";
my $begincount=index($keysword,":");
my($file);
open(FILEH,$dir.$filename);
while(my $test=<FILEH>){
if((index($test,$keysword))>=0){
my $test1=substr($test,$begincount+1,$count);
print "$test1";
}
}
close(FILEH);
----------------------------------------
test0823.txt内容为:
aaa:111
bbb:222
ccc:333
ddd:444
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载