Perl【学习篇】

  • practical extraction and report language

  • #!usr/bin/perl 是 perl文件解释器的路径

#!usr/bin/perl -w    "#"用于单行注释;在后面加-w可以显示程序中出现的一些警告

基础语法

确认安装

perl -v    ##通过此命令判断环境下是否已安装perl

执行

perl -c sasa.pl    #-c是检查语法,实际没有运行,防止执行后有不可预估的问题
perl sasa.pl    #去掉-c就可以执行了
perl -e 'print "hello sasa\n"'  #也可以直接在linux命令处写
  • 确保文件有可执行权限,在terminal处输入:
chmod 0755 sasa.pl

就不用每次都打这么一长串了;直接在terminal敲文件名回车:

sasa.pl

比如test.pl的内容是:

#!usr/bin/perl
print "hello sasa!\n";

注释

=pod
these comments will be ignored
=cut     ###   “=”可以用pod进行多行注释  plain old documentations

空格

#!usr/bin/perl
print      "hello,sasa\n"#多个空格,原样输出
#!usr/bin/perl
print "hello
         sasa\n"#会输出多行

hello
空格空格空格sasa

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值