想要開發Perl語言,對於習慣使用Windows且沒有Linux平台的人,可以在Windows中安裝ActivePerl,照著步驟下一步、下一步就可以安裝完成。 


ActivePerl的官方網頁與下載網頁:http://www.activestate.com/activeperl/downloads

請自行選擇適合你電腦的安裝版本

 

安裝完成後,可以在命令提示字元底下輸入perl -v檢查Perl的版本

命令提示字元不會開啟...可以按windows鍵+R 輸入cmd 或是 開始=>執行=>輸入cmd


輸入之後就會出現以下的一大串文字,主要看得就是第一行,perl 5, version 16, subversion 1 (v5.16.1),表示這是Per的第5.16.1版本。

This is perl 5, version 16, subversion 1 (v5.16.1) built for MSWin32-x86-multi-thread
 (with 1 registered patch, see perl -V for more detail)

Copyright 1987-2012, Larry Wall

Binary build 1601 [296175] provided by ActiveState http://www.ActiveState.com
Built Aug 30 2012 20:08:55

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


接下來就可以在Windows上,開發與撰寫Perl語言了。

 

建議安裝完之後,先重開機,否則無法正常使用Perl。

 


 

不曉得為什麼,在程式語言的世界裡,不論是書籍或是網路上看到的,學一個新程式都是從Hello World開始。

開啟一個hello.txt文字檔,在文字檔中鍵入 print "Hello World!\n"; 

接著將命令提示字元切換到該文字檔的路徑,利用"cd"來切換路徑,cd..是回到上一層,cd xxx,則是前往xxx資料夾

接著在命令提示字元中鍵入perl hello.txt,螢幕會顯示Hello World!

這就表示Perl以成功安裝並且正常運作了。


若你的程式只有一行,你也可以直接在命令提示字元中鍵入 perl -e "print 'Hello World!';" ,

這裡的-e參數意思是要perl把後面的參數當作是一個程式來執行。

 



提供一個滿有用的網站:

Perl的基本語法 http://ind.ntou.edu.tw/~dada/cgi/Perlsynx.htm


arrow
arrow
    全站熱搜

    Chibli/紅蜻蜓 發表在 痞客邦 留言(0) 人氣()