- 論壇徽章:
- 145
|
回復 1# zjpixyniannian
How about this to get the item and value
$ cat get_item_value.pl
use strict;
use warnings;
$_ = 'createby=root and date=20121115 and type=insert';
my $sCnt = 0;
print "string= '$_'\n";
while(m/(\S+)=(\S+)/g){
$sCnt++;
my ($sItem, $sValue) = ($1, $2);
print "cnt=$sCnt, item=$sItem, value=$sValue\n";
}
$ perl get_item_value.pl
string= 'createby=root and date=20121115 and type=insert'
cnt=1, item=createby, value=root
cnt=2, item=date, value=20121115
cnt=3, item=type, value=insert
|
|