Perl_Syntax

12 篇文章 0 订阅
1 篇文章 0 订阅
Perl
===================
** Introduction **

Practical Extraction and Report Language,实用报表提取语言
Larry Wall, 1987.12.18
<< C, sed, awd, shell scripting
!! 正则表达式,CPAN(the Comprehensive Perl Archive Network
/usr/lcoal/bin/perl, /usr/bin/perl
注释:#

===================
** Simple Variable **

$开头, 初始值为""
Int, 实际上当做浮点数看待
  十进制
  八进制:0
  十六进制:0[x|X]
Float
String
  单引号
  双引号
  转义字符

===================
** Operand **

算术: + - * / ** % -
比较: < > == <= >= != <=>
      lt,gt,eq,le,ge,ne,cmp
逻辑: || && ! xor and not or
位  : & | ~ ^ << >>
赋值: = += -= *= 、= %= **= &= |= ^=
增减: ++ --
字符串: . x .=
逗号: ,
条件: ?:
正则: =~ !~
文件: -e -r

===================
** List and Array **

(),@
数组初始值为空表,列表存储在数组里
存取: $array[]
范围: (1..5),(1.1..5.3),("aaa".."aad")
子组: @array[1,3],@array[1..3]
函数: sort, reverse, chop, join, split

===================
** File **

打开: open(hdl, fn) >,>>
读:  <hdl>
写:   print hdl 
判断: -e, -z
参数: @ARG|<>
管道: open(hdl, fn) |
关闭: close

===================
** 模式 **

//, =~, !~
计数: +,*,? {}
分组: [],[^]
转义: \
锚:   ^ $ \b \B
转义: \d \D \w \W \s \S
任意: .
选择: |
重用: () $n
选项: g,i,m,o,s,x
替换: s/ptn/rep/
翻译: tr/str/str2/ c,d,s
扩展: ?:,?= ?! 
注释: ?#

===================
** 控制 **

条件: if/elsif/else
循环: while,until,for,do,last,next
单行: if, unless, while, until

===================
** Subroutine **

sub sr{}, &sr, do sr
返回值: return
局部: my, local
别名: &sr(*array)
预定义: BEGIN, END, AUTOLOAD

===================
** Hash **

% {}, delete
索引: keys,each

===================
** Format IO **

$~, format
write,printf
格式: @<<<, @>>>,@|||,@##.##,@*

===================
** File System **

文件: open, close, print, write, printf, select, eof, 
      seek, tell, read, sysread, syswrite, getc, binmode
目录: mkdir,chdir,opendir,closedir,readdir,telldir,rewinddir,rmdir
属性: rename
      unlink,link,syslink,readlink
      chmod,chown,umask
      truncate
      stat,lstat
      time,gmtime,localtime,utime
      fileno,fcntl,
      dbmopen,dbmclose

===================
** Reference **

\

===================
** Object Oriented **

package,::,'
bless
@INC,@ISA

===================
** Package and Module **

require
use no

===================
** Functions **

进程: eval, system, fork, pipe, exec, syscall
      die, warn, exit, kill
      sleep, wait, caller, chroot, local, times
数学: sin, cos, atan2
      sqrt, exp, log, abs
      rand, srand
字符串: index, rindex, length, pos, substr, study
        lc, lcfirst, quotemeta, join, sprintf
标量: chop, chomp, crypt, hex, int, oct, ord, chr
      pack, unpack, vec, defined, undef
数组: grep, splice, shift, unshift, push, pop
      split, sort, reverse, map, wantarray
关联: keys, values, each, delete, exists, 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值