两个相同的Perl脚本,但一个不起作用?

时间:2017-07-24 20:44:41

标签: perl

我正在处理Materials Studio中的脚本,这是一种分子可视化软件。此软件中的脚本在Perl中完成。我有两个版本的脚本,多个文本比较网站已验证相同,但一个脚本工作正常,另一个退出,给出bogus errors

screenshot

以下是两个版本:

1 :(这个有效)

.

2 :(这个不起作用)

#!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";

任何人都可以找出为什么这不起作用?看起来这两个块是100%相同的。我得到的错误没有意义 - 评论行会有什么错误?

1 个答案:

答案 0 :(得分:0)

我同意Steffen的说法,检查行末尾的^ M个字符,通常会导致.txt文件出现问题。你是否将它们保存在制表符分隔文本或Windows格式的文本中,因为后者不会在末尾添加奇数字符。