1-2 �u�W�䴩�P²��d��

·í§A¤U¸ü Perl ª½Ä¶¾¹¨Ã¦w¸Ë©ó§Aªº¹q¸£«á¡APerl À³¸Ó´N¤w¸g¦ì©ó§Aªº¹q¸£ªº°õ¦æ¸ô®|¤§¤¤¤F¡A¦]¦¹­n´ú¸Õ Perl ¬O§_¦w¸Ë§¹¦¨¡A¥u»Ý¦b©R¥Oµøµ¡¤U¿é¤J¡G perl -v ¦¹®É¹q¸£¿Ã¹õ§Y·|¦^À³Ãþ¦ü¤U¦C¤§°T®§¡G This is perl, v5.6.0 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2000, Larry Wall Binary build 613 provided by ActiveState Tool Corp. http://www.ActiveState.com Built 12:36:25 Mar 24 2000 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.0 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.com/, the Perl Home Page. ­Y§A¨£¨ì¦¹°T®§¡A¤j·§´N¥i¥H½T»{ Perl ¤w¦w¸Ë§¹¦¨¡C¡]¥Ñ¦¹°T®§¤]¥i¥H¬Ý¥X¡A§Úªº Perl ¬O¥Ñ ActiveState ¤½¥q­×§ï«áªº Win32 ª©¥»¡C¡^

­Y­n¨ú±oºë²ªº½u¤W¤ä´©¡A¥i¥H¿é¤J¡G

perl -h ¦^À³°T®§¦p¤U¡G Usage: C:\Perl\bin\Perl.exe [switches] [--] [programfile] [arguments] -0[octal] specify record separator (\0, if no argument) -a autosplit mode with -n or -p (splits $_ into @F) -C enable native wide character system interfaces -c check syntax only (runs BEGIN and END blocks) -d[:debugger] run program under debugger -D[number/list] set debugging flags (argument is a bit mask or alphabets) -e 'command' one line of program (several -e's allowed, omit programfile) -F/pattern/ split() pattern for -a switch (//'s are optional) -i[extension] edit <> files in place (makes backup if extension supplied) -Idirectory specify @INC/#include directory (several -I's allowed) -l[octal] enable line ending processing, specifies line terminator -[mM][-]module execute `use/no module...' before executing program -n assume 'while (<>) { ... }' loop around program -p assume loop like -n but print line also, like sed -P run program through C preprocessor before compilation -s enable rudimentary parsing for switches after programfile -S look for programfile using PATH environment variable -T enable tainting checks -u dump core after parsing program -U allow unsafe operations -v print version, subversion (includes VERY IMPORTANT perl info) -V[:variable] print configuration summary (or a single Config.pm variable) -w enable many useful warnings (RECOMMENDED) -W enable all warnings -X disable all warnings -x[directory] strip off text before #!perl line and perhaps cd to directory ³o¨Çºë²ªº½u¤W¤ä´©¡A¹ïªì¾ÇªÌ¨Ó»¡¡A¥i¯àÁÙ¬O²`¶ø¤F¤@¨Ç¡C­Y­n¨ú±o§ó¸Ô²Óªº½u¤W¤ä´©¡A¥i¥H¹Á¸Õ perldoc ©R¥O¡A¨Ò¦p¡G perldoc perl ­Y­n¬d¸ß perldoc ¥»¨­ªº¥\¯à¡A¥i¿é¤J¡G perldoc perldoc ­Y­n¬d¸ß perl ªº¦UºØ¨ç¼Æ¡A¥i¥H¿é¤J¡G perldoc perlfunc ­Y­n¬d¸ß¬Y¤@­Ó¯S©wªº¨ç¼Æ¡A¨Ò¦p print¡A¥i¿é¤J¦p¤U¡G perldoc -f print ¥Ñ©ó¤W­z©R¥O¦^À³ªº°T®§¬Û·í¦h¡A¦b¦¹¤£¤@¤@¦C¥X¡AŪªÌ¥i¦Û¦æ¸Õ¸Õ³o¨Ç©R¥O¡C

Perl ¤]¦³ HTML ®æ¦¡ªº½u¤W¤ä´©¡A°²³]§Aªº Perl ªº¦w¸Ë¥Ø¿ý¬O c:\perl¡A¨º»ò§A¥i¥H¦b DOS ©R¥Oµøµ¡¤U¿é¤J¤U¦C±Ô­z¡A¥H Web ÂsÄý¾¹¶}±Ò HTML ®æ¦¡ªº½u¤W¤ä´©¡G

start c:\perl\html\index.html ©Ò¶}±Òªº½u¤W¤ä´©¦p¤U¡G

§Ú­Ì¥ý¬Ý¤@­Ó³Ì²³æªº Perl µ{¦¡¡A¨ä¥\¯à¥u¬O¦L¥X¤@¦C¤å¦r¡uHello World!¡v¡Aµ{¦¡½X¡]hello.pl¡^¦p¤U¡G

­ì©lÀÉ¡]hello.pl¡^¡G¡]¦Ç¦â°Ï°ì«ö¨â¤U§Y¥i«þ¨©¡^
#! /user/local/bin/perl
# My first Perl program
print "Hello World!";

°²³]¥]§t¤W­zµ{¦¡½XªºÀɮ׬° hello.pl¡A­Y­n°õ¦æ¦¹ÀɮסA¥i¦b DOS ©R¥Oµøµ¡¤U¿é¤J¤U¦C¤å¦r¡G

perl hello.pl ¦¹®É§Y·|¦b»È¹õ¤W¦L¥X¡uHello World!¡v¡C§Ú­Ì²{¦b³v¦C¸ÑÄÀµ{¦¡½X¡A¦p¤U¡G
  1. ¥u­n¬O¥H¡u#¡v¶}ÀYªº±Ô­z¡A´N¥Nªí¬Oµù¸Ñ¡A¹ïµ{¦¡ªº°õ¦æ§¹¥þµL¼vÅT¡C¦]¦¹²Ä¤@¦Cµ{¦¡½X¦b Win32 ¥­¥x§¹¥þ¤£°_§@¥Î¡C¦ý¦b UNIX ¥­¥x¡A¥H¡u#!¡v¶}ÀYªº±Ô­z¡A§Y§i¶D§@·~¨t²ÎÀ³¦p¦ó°õ¦æ¦¹µ{¦¡ÀÉ¡A¥H¦¹¨Ò¦Ó¨¥¡A§@·~¨t²Î·|©I¥s¡u/usr/local/bin/perl¡v¨ÓŪ¤J¦¹µ{¦¡Àɨðõ¦æ¤§¡C´«¥y¸Ü»¡¡A¦b UNIX ¥­¥x¤W¡A°£¤F¥i¥H¨Ï¥Î¤W­zªº¤èªk¨Ó°õ¦æ hello.pl ¤§¥~¡A¥ç¥i¥Ñ¤U¦C¤è¦¡±N hello.pl §ï¦¨¥i°õ¦æÀÉ¡G chmod +x hello.pl ©Î chmod 755 hello.pl µM«á¦b UNIX ©R¥Oµøµ¡¤Uª½±µ¿é¤J¡uhello.pl¡v¡A¦¹®É§@·~¨t²Î´N·|¸g¥Ñ¥]§t¡u#!¡vªº²Ä¤@¦C¡A§ä¥X Perl ªº¸ô®|¡A¨Ã¥Ñ¦¹ Perl ¨Ó°õ¦æ¨C¦Cµ{¦¡½X¡C
  2. ²Ä¤G¦Cµ{¦¡½X¬O¤@­Ó¼Ð·Çªºµù¸Ñ¡A¥Î¨Ó»¡©ú¦¹µ{¦¡ªº¥\¯à¡C
  3. ²Ä¤T¦C«h¬O§Q¥Î print «ü¥O¨Ó¦L¥X¡uHello World!¡v¡C
¦b Win32 ¥­¥x¤W¡A¬O§_¯à°÷ª½±µ¿é¤J Perl µ{¦¡ÀÉ¡A§Y¥i¶}©l°õ¦æ¡Hµª®×¬OªÖ©wªº¡C¦bNT4.0¥H¤Wªºª©¥»¡A§A¥u­n¦b DOS ©R¥Oµøµ¡¿é¤J¤U¦C±Ô­z§Y¥i¡G assoc .pl=perl ftype perl=c:\perl\bin\perl.exe %1 %* ¡]¨ä¤¤¦Ü²Ä¤G¦C±Ô­z¤¤¡A§A¥²¶·§¹¾ãªº¼g¥X Perl ªº¸ô®|¡C¡^°õ¦æ§¹³o¨Ç±Ô­z«á¡A´N¥i¥H¦b DOS ©R¥Oµøµ¡¤U¿é¤J¡uhello.pl¡v¨Ó°õ¦æ¦¹µ{¦¡½X¡C¦¹¥~¡A§A¤]¥i¥Hª½±µ¿é¤J¡uhello¡v¨Ó°õ¦æ hello.pl¡A¦ý¥²¶·¥ý¦b DOS ©R¥Oµøµ¡¤U¿é¤J¤U¦C±Ô­z¡G set PATHEXT=%PATHEXT%;.pl ¦b¤W­zªº»¡©ú¤¤¡A§Ú­Ì³£°²³] Perl µ{¦¡½X¦b Win32 ¥­¥xªº°ÆÀɦW¬O pl¡A¦ý³o¥u¬O¤@¯ë¶Ç²Î¦Ó¤w¡A§A¤]¥i¥H¿ï¥Î¨ä¥Lªº°ÆÀɦW¡A¥H²Å¦X­Ó¤H³ß¦n¡C¡]¦ý­Y¿ï¥Î¤£¦Pªº°ÆÀɦW¡A¦b¤W­zªº©R¥O¤¤¡A§A´N¥²¶·±N pl §ï¦¨·sªº°ÆÀɦW¡C¡^

¦b¥»³¹¨ä«áªº»¡©ú©M½d¨Ò¡A³£¬O¥H ActiveState ¤½¥q©Ò­×§ïªº Win32 Perl ª©¥»¬°¥D¡C­Y§A¨Ï¥Îªº Perl ª©¥»©M¥»®Ñ¤£¦P¡Aµ²ªG¥i¯à²¤¦³¤£¦P¡A¦ýÀ³¸Ó¤j¦P¤p²§¡C


Perl