运行Perl程序———hello.plx

昨天把第一个python程序运行出来了,很容易。

今天运行Perl程序的时候,发现运行不了,书里面记载的是unix里面的运行方式,在百度里面找了找,好几个网页里面写的都是乱七八糟的东西。

去了一趟官方文档原来真有。

To run your Perl scripts, enter the following command at the command prompt:

perl -w yourscriptname.pl

Where yourscriptname.pl is the name of the script you want to run. If you are using Windows and have associated the extension of the file with Perl, typing yourscriptname.pl (that is, without calling perl first) will also launch the script.


随便用了一个文本编辑器写了一个入门的程序。

#!/usr/bin/perl
print "Hello, world!\n";


保存为hello.plx 

在windows下的run里面写cmd按回车,然后进入hello.plx的所在的文件目录里面。

perl -w hello.plx

出现运行了结果(当然我事先安装了activePerl,当前在Perl的官方网站上推荐的几款免费的编译器也可以):

Hello, world

感觉很爽。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章