读 《C程序员精通Perl》http://book.douban.com/subject/1232075/ 2.1节 笔记
学习一门新语言,先写个hello world,就可以知道此语言的大概结构
#!/usr/bin/perl
use strict;
use warnings;
print "hello world\n";
运行结果:
[root@localhost perl_practice]#
[root@localhost perl_practice]# chmod +x hello.pl
[root@localhost perl_practice]# perl hello.pl
hello world
[root@localhost perl_practice]# ./hello.pl
hello world
[root@localhost perl_practice]#
#!/usr/bin/perl --- 解释器文件(interpreter file)
use strict; --- 打开严格语法和变量检查
use warnings; --- 打开附加编译和运行时的告警。在perl的5.6版本之前,要在命令行使用-w进行打开,如#perl -w hello.pl
print "hello world\n"; --- 打印字符串