的出现次数的直线比方说,我有一个Perl的字符串变量SQL查询:拆分基于字符串
select a from table one union select b from table two union select c from table three union select d from table four union select e from table five union select f from table six union select g from table seven union select h from table eight
在上面的文字我有一个工会分隔八个单独的查询。
我希望其中一半存储在一个变量中,另一半存储在另一个变量中。
我知道应该有八个查询所有的时间和7个工会之间。 我试了下面的脚本,但是不工作。
#!/usr/bin/perl
use strict;
use warnings;
my $var="select a from table one union select b from table two union select c from table three union select d from table four union select e from table five union select f from table six union select g from table seven union select h from table eight";
$var=~m/(.*union{3})(.*)/g;
print $1;
第一场比赛$ 1是确定..但第二场比赛是不正确的。 – user1939168 2013-03-18 13:57:04
@ user1939168:澄清了答案。 – creinig 2013-03-18 14:09:25