在Windows 7中安装Perl [英] installing perl in windows 7
问题描述
我是Perl的外行,从没使用过...但是现在我想使用它.
I am pretty layman to Perl, never used it ...but now I want to use it.
这就是我所做的:
http://www.activestate.com/activeperl/downloads
我安装了通用版本-5.12.4.1205
I installed universal version - 5.12.4.1205
为了测试我的程序是否正常运行,我使用了以下小程序:
To test my program is working, I used the following small program :
dnacon.plx
dnacon.plx
#i/Perl64/bin/perl -w
#Example 1-1 Concatenating DNA
$DNA1 = 'ATTTGGTAAAATGTATA'
$DNA2 = 'TTTTGGGTTTGAAAT'
print "Here are two DNA fragments: \n\n"
print $DNA1, "\n\n"
print $DNA2, "\n\n"
$DNA3 = "$DNA1$$DNA2"
print "$DNA3\n\n
当我尝试执行它时,以下是带有错误的命令提示符.
When I try to execute it the following is command prompt with errors.
很抱歉出现了太基本的问题...
Sorry for too basic question...
EDTIS:
When I just type dnacon.plx, it is seems that it is working, but with error !!!
c:\myperllessions>dnacon.plx
Scalar found where operator expected at C:\myperllessions\dnacon.plx line 5, nea
r "$DNA2"
(Missing semicolon on previous line?)
syntax error at C:\myperllessions\dnacon.plx line 5, near "$DNA2 "
Execution of C:\myperllessions\dnacon.plx aborted due to compilation errors.
我可以去吗???什么可能是错误...编译错误????
Am I good to go ??? What could be the error ...compilation errors ????
我现在正在使用以下内容:这是正确的吗?
I am using the following now : is this correct ?
#i/Perl64/bin -w
我将脚本更改为以下内容:
I changed my script to following:
#i/Perl64/bin -w
#Example 1-1 Concatenating DNA
use strict;
use warnings;
$DNA1 = 'ATTTGGTAAAATGTATA';
$DNA2 = 'TTTTGGGTTTGAAAT';
print "Here are two DNA fragments: \n\n";
print $DNA1, "\n\n";
print $DNA2, "\n\n";
$DNA3 = "$DNA1$$DNA2";
print "$DNA3\n\n";
我遇到以下错误:
c:\ myperllessions> dnacon.plx
c:\myperllessions>dnacon.plx
Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 5.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 6.
Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 9.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 10.
Global symbol "$DNA3" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA1" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA2" requires explicit package name at C:\myperllessions\dnacon
.plx line 12.
Global symbol "$DNA3" requires explicit package name at C:\myperllessions\dnacon
.plx line 13.
Execution of C:\myperllessions\dnacon.plx aborted due to compilation errors.
现在是我的编程知识问题还是与安装有关的问题?????
Is my problem now with programming knowledge or something to do with installation ?????
推荐答案
要使perl
被识别,必须将C:\Perl64\bin
添加到PATH
环境变量中.转到Control Panel > System > Advanced System Settings > Environment Variables
.在顶部的标记为User variables for <user>
的框中编辑包含PATH
的行,并在末尾添加;C:\Perl64\bin
(注意分号).确保不要破坏已经存在的任何东西.
To get perl
to be recognized, you must add C:\Perl64\bin
to the PATH
environment variable. Go to Control Panel > System > Advanced System Settings > Environment Variables
. Edit the line containing PATH
in the top box marked User variables for <user>
, and add ;C:\Perl64\bin
(note the semicolon) to the end. Be sure not to corrupt anything that's already there.
在最新编辑-Global symbol requires explicit package name
中遗留下的问题是因为您添加了use strict
(这是一件非常好的事情)并且没有声明变量.同样,行#i/Perl64/bin -w
不会执行任何操作,也可以将其删除.改写这个
The problems you are left with in your latest edit - Global symbol requires explicit package name
- are because you have added use strict
(a very good thing to do) and you haven't declared your variables. Also the line #i/Perl64/bin -w
won't do anything and may as well be removed. Write this instead
use strict;
use warnings;
my $DNA1 = 'ATTTGGTAAAATGTATA';
my $DNA2 = 'TTTTGGGTTTGAAAT';
print "Here are two DNA fragments: \n\n";
print $DNA1, "\n\n";
print $DNA2, "\n\n";
my $DNA3 = "$DNA1$$DNA2";
print "$DNA3\n\n";
这篇关于在Windows 7中安装Perl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!