Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
两个相同的Perl脚本,但其中一个没有';不行?_Perl - Fatal编程技术网

两个相同的Perl脚本,但其中一个没有';不行?

两个相同的Perl脚本,但其中一个没有';不行?,perl,Perl,我在Materials Studio中使用脚本,这是一个分子可视化软件。这个软件中的脚本是用Perl编写的。我有两个版本的脚本,多个文本比较站点已经验证了它们是相同的,但一个脚本工作正常,另一个退出,给出: 以下是两个版本: 1:(这个有效) 2:(这个不起作用) 有人知道为什么这样不行吗?这两个区块似乎100%相同。我得到的错误毫无意义-注释行中怎么会有错误?我同意Steffen的观点,请检查行尾的^m字符,它们通常会导致.txt文件出现问题。您是否将它们保存在制表符删除文本或windows

我在Materials Studio中使用脚本,这是一个分子可视化软件。这个软件中的脚本是用Perl编写的。我有两个版本的脚本,多个文本比较站点已经验证了它们是相同的,但一个脚本工作正常,另一个退出,给出:

以下是两个版本:

1:(这个有效)

2:(这个不起作用)


有人知道为什么这样不行吗?这两个区块似乎100%相同。我得到的错误毫无意义-注释行中怎么会有错误?

我同意Steffen的观点,请检查行尾的^m字符,它们通常会导致.txt文件出现问题。您是否将它们保存在制表符删除文本或windows格式文本中,因为后者不会在末尾添加奇数字符。

那么它们之间有什么不同?文件名?它们在同一个系统上吗?您是否以不同的用户身份运行它们?从不同的目录?@ysth,我直接一个接一个地运行它们,从同一个文件夹,在同一个软件中,作为同一个用户,等等。您是如何运行它们的?因为错误消息显示的是
-e
,它指的是命令行脚本,而不是文件。我猜在一个文件中有一些不可见的字符,如
\0
,会扰乱解析过程。如果您仅在文本比较网站上复制并粘贴这些文件,或在此处,这些非文本字符将自动剥离,即这些文件看起来相同,但不相同。如果你希望它们是一样的,就把坏的去掉,把好的复制过来。有一件事是肯定的。。。他们不一样。。。
#!perl

# originally part of project:Chi_Flexibles_Sys

#########################################################################################################################################
# README:


# Copyright (C) -------------------,  - All Rights Reserved
# Proprietary Software, All Use Must Be Licensed.
# This software is protected by U.S. Copyright Law and International Treaties. Unauthorized use, duplication, reverse engineering,
# any form of redistribution, or use in part or in whole other than by prior, express, printed and signed license for use is strictly prohibited.
# If you have received this file in error, please notify copyright holder and destroy this and any other copies
# as instructed.

# Copyright (c) 2016,-------------------
# Please donot remove and/or modify this copyright notice from the script without permission from the copyright holder.

#########################################################################################################################################

my $dir='C:\Users\USERNAME\Documents\Materials Studio Projects\2016-October-nanoreactor\Dimers Files\Documents\Case_5_(D)\Blends\AB\A2 Blends Mixing\Lowest energies'; #put in the current directory, because cwd() doesn't work

my $monomer1 = 'A2';
my $monomer2 = 'B2';

my $outfile1 = "$dir\\$monomer1 $monomer1.txt";
my $outfile2 = "$dir\\$monomer1 $monomer2.txt";
my $outfile3 = "$dir\\$monomer2 $monomer2.txt";

my $forcefield = "Dreiding";
#!perl

# originally part of project:Chi_Flexibles_Sys

#########################################################################################################################################
# README:


# Copyright (C) -------------------,  - All Rights Reserved
# Proprietary Software, All Use Must Be Licensed.
# This software is protected by U.S. Copyright Law and International Treaties. Unauthorized use, duplication, reverse engineering,
# any form of redistribution, or use in part or in whole other than by prior, express, printed and signed license for use is strictly prohibited.
# If you have received this file in error, please notify copyright holder and destroy this and any other copies
# as instructed.

# Copyright (c) 2016,-------------------
# Please donot remove and/or modify this copyright notice from the script without permission from the copyright holder.

#########################################################################################################################################

my $dir='C:\Users\USERNAME\Documents\Materials Studio Projects\2016-October-nanoreactor\Dimers Files\Documents\Case_5_(D)\Blends\AB\A2 Blends Mixing\Lowest energies'; #put in the current directory, because cwd() doesn't work

my $monomer1 = 'A2';
my $monomer2 = 'B2';

my $outfile1 = "$dir\\$monomer1 $monomer1.txt";
my $outfile2 = "$dir\\$monomer1 $monomer2.txt";
my $outfile3 = "$dir\\$monomer2 $monomer2.txt";

my $forcefield = "Dreiding";