tez.homeunix.com/blog

ActivePerl で Hello world! (Win)

May 10th 2008
One Comment
respond
trackback

ActivePerlのインストールの続き。簡単な動作確認のために Hello World してみます。

1. インストールの確認

コマンドプロンプトからコマンド perl -v を入力します。正しくインストールされていば、インストールされた Perl のバージョンが返されます。

C:¥Documents and Settings¥Administrator>perl -v

This is perl, v5.10.0 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)

Copyright 1987-2007, Larry Wall

Binary build 1002 [283697] provided by ActiveState http://www.ActiveState.com
Built Jan 10 2008 11:00:53

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.

正しくバージョンが返されました。

Perl -v の実行状況
Perl -v の実行状況

2. ソースの作成

テキストエディタで以下の以下のソースを作成し、Hello.plとして任意のフォルダ(今回は c:¥src¥ )に保存します。

print “HelloWorld!”

3. Hello world! の実行

コマンドプロンプトから Hello.pl を実行します

C:¥Documents and Settings¥Administrator>cd c:¥src

C:¥src>Hello.pl
HelloWorld!
C:¥src>

ソースにパスを記入しなくても動きます。また、環境変数を削除しても動きました。インストール時に拡張子.plが関連付けられているためでしょうか。

次はEclipseによるPerlの統合開発環境を構築します。


This post is tagged , , ,

One Comment

Leave a Reply