perl基础知识02【代码执行格式】
[oracle@localhost ~]$ perl --help
Usage: perl [switches] [--] [programfile] [arguments] ? -0[octal]?????? specify record separator ( ,if no argument) ? -a????????????? autosplit mode with -n or -p (splits $_ into @F) ? -C[number/list] enables the listed Unicode features ? -c????????????? check syntax only (runs BEGIN and CHECK blocks) ? -d[:debugger]?? run program under debugger ? -D[number/list] set debugging flags (argument is a bit mask or alphabets) ? -e program????? one line of program (several -e's allowed,omit programfile) #这个参数也常用,当在后面执行命令行时;如 [oracle@localhost ~]$ perl -e' print "okn"' ? -F/pattern/???? split() pattern for -a switch (//'s are optional) ? -i[extension]?? edit <> files in place (makes backup if extension supplied) #直接在原文件上做修改!做时记得做个备份 ? -l[octal]?????? enable line ending processing,specifies line terminator ? -[mM][-]module? execute "use/no module..." before executing program ? -n????????????? assume "while (<>) { ... }" loop around program #当作是循环,此选项经常使用,假定一个文本有10行内容,那么如果要处理这10行,你就要加上此参数; ? -p????????????? assume loop like -n but print line also,like sed #暂时未看出是什么用处的 ? -P????????????? run program through C preprocessor before compilation #在编译之前通过C预处理器运行 ? -s????????????? enable rudimentary parsing for switches after programfile #待确定 ? -S????????????? look for programfile using PATH environment variable #它会去$PATH目录中去寻找你要执行的程序,而不会在默认的当前目录 ? -t????????????? enable tainting warnings #开启损坏警告 ? -T????????????? enable tainting checks #开启损坏核对 ? -u????????????? dump core after parsing program [oracle@localhost ~]$ cat perl01 ? -U????????????? allow unsafe operations ? -v????????????? print version,subversion (includes VERY IMPORTANT perl info) #直接输入perl -v 输出版本信息 ? -V[:variable]?? print configuration summary (or a single Config.pm variable) #:直接输入perl -V 输出配置汇总 ? -w????????????? enable many useful warnings (RECOMMENDED) [oracle@localhost ~]$ cat perl01 [oracle@localhost ~]$ perl perl01 ? -x[directory]?? strip off text before #!perl line and perhaps cd to directory #格式类似于:perl -xzbkdir? perl01? #其中zbkdir为一目录名,具体用处还不详; ? -X????????????? disable all warnings [oracle@localhost ~]$ perl -X perl01 兴例: (1)-ne [oracle@localhost ~]$ cat >01.txt (2)-i #在原文件基础上直接修改 [oracle@localhost ~]$ perl -i -ne' #以上操作要切记备份,以免悲剧发生! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |