linux下运行方式:
##交互式运行
#perl -e <code>
perl -e "print \"hello world\n\"" #"内的"需转义,如用',\n原样输出,不换行
#perl <script.pl>
perl hello.pl
##脚本运行
#<script.pl>
hello_script.pl
所用代码:
#hello.pl:
print "hello world\n";
#hello_script.pl:
#!/usr/bin/perl -w #直接运行方式需要指定perl位置;-w显示警告,如变量未定义,只使用一次等
print "hello world\n";