[root@jenkins ~]# cat a1.pl
my $start_dt = $ARGV[0];
my $end_dt = $ARGV[1];
my $str=`echo --start-datetime='$start_dt' --stop-datetime='$end_dt'`;
print "$str is $str
";
[root@jenkins ~]# perl a1.pl '2016-12-31' '20171231'
$str is --start-datetime=2016-12-31 --stop-datetime=20171231
[root@jenkins ~]# perl a1.pl 2016-12-31 20171231
$str is --start-datetime=2016-12-31 --stop-datetime=20171231
此时虽然单引号,仍旧正常解析
[root@jenkins ~]# cat a2.pl
my $db_name=$ARGV[0];
my $table= $ARGV[1];
my $hostSql = qq{SELECT column_name from information_schema.columns where table_schema='$db_name' and table_name='$table'};
print "$hostSql is $hostSql
";
[root@jenkins ~]# perl a2.pl zjzc Client
$hostSql is SELECT column_name from information_schema.columns where table_schema='zjzc' and table_name='Client'