生成字符串连接文本

生成字符串连接文本,也可以将一种字符串连接文本转化为另一种字符串连接文本

[文件] strConn.pl
#!perl
use strict;
use warnings;
#原始字符串
my $src_str='select username,
				userid,
				deptid,
				roleid
				from user u,role r,dept d
				where u.deptid=d.id
				and u.roleid=r.id
				and u.userid=\'zhang\'';
#原始连接符
my $src_conn="\n";
#目标字符串标示符
my $target_quote='"';
#目标连接符
my $target_conn="+\n";

print join $target_conn,map {$target_quote.$_.$target_quote} split(/$src_conn/,$src_str);