perl无法打印所需的输出

perl无法打印所需的输出,perl,sqlplus,Perl,Sqlplus,您好,我正在编写一个perl脚本,使用SQL Plus连接到数据库,但是当我查询出数据时,它没有显示正确的输出,有人能解释一下吗 $perl test.pl-u user-p paswd-d数据库 输出屏幕:我希望输出为sysdate SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 25 13:13:38 2019 Copyright (c) 1982, 2011, Oracle. All rights reserved. Conne

您好,我正在编写一个perl脚本,使用SQL Plus连接到数据库,但是当我查询出数据时,它没有显示正确的输出,有人能解释一下吗

$perl test.pl-u user-p paswd-d数据库

输出屏幕:我希望输出为sysdate

SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 25 13:13:38 2019

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SQL>   2  Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

我认为有一个
缺失

$output=`echo“从dual中选择sysdate;“| sqlplus$dbuser\/$dbpasswd\@$db`”;

Sqlplus需要许多设置才能使用。我建议:

$output=`( echo "set heading off" ; echo "set feedback off" ; echo "set newpage none" ; echo "set pagesize 0" ; echo "select sysdate from dual;" )  | sqlplus -s $dbuser\/$dbpasswd\@$db`;
别忘了咀嚼结果:

chomp $output

为什么不使用
DBI
DBD::Oracle
?需求是这样的,这并不是问题的真正答案。问题到底是什么?你展示了你所得到的,但我没有看到任何错误信息,也没有什么特别之处。您期望的是什么?请注意,您的代码存在多个代码注入错误。
chomp $output