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,
Perl_Syntax
最新推荐文章于 2023-07-10 18:03:12 发布