perlop.1
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· 1 代码 · 共 1,599 行 · 第 1/5 页
1
1,599 行
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings. \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote. \*(C+ will.\" give a nicer C++. Capital omega is used to do unbreakable dashes and.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\. ds -- \(*W-. ds PI pi. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch. ds L" "". ds R" "". ds C` "". ds C' ""'br\}.el\{\. ds -- \|\(em\|. ds PI \(*p. ds L" ``. ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD. Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff.if n \{\. ds #H 0. ds #V .8m. ds #F .3m. ds #[ \f1. ds #] \fP.\}.if t \{\. ds #H ((1u-(\\\\n(.fu%2u))*.13m). ds #V .6m. ds #F 0. ds #[ \&. ds #] \&.\}. \" simple accents for nroff and troff.if n \{\. ds ' \&. ds ` \&. ds ^ \&. ds , \&. ds ~ ~. ds /.\}.if t \{\. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u". ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}. \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E. \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'. \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\. ds : e. ds 8 ss. ds o a. ds d- d\h'-1'\(ga. ds D- D\h'-1'\(hy. ds th \o'bp'. ds Th \o'LP'. ds ae ae. ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "PERLOP 1".TH PERLOP 1 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification. Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"perlop \- Perl operators and precedence.IX Xref "operator".SH "DESCRIPTION".IX Header "DESCRIPTION".Sh "Operator Precedence and Associativity".IX Xref "operator, precedence precedence associativity".IX Subsection "Operator Precedence and Associativity"Operator precedence and associativity work in Perl more or less likethey do in mathematics..PP\&\fIOperator precedence\fR means some operators are evaluated beforeothers. For example, in \f(CW\*(C`2 + 4 * 5\*(C'\fR, the multiplication has higherprecedence so \f(CW\*(C`4 * 5\*(C'\fR is evaluated first yielding \f(CW\*(C`2 + 20 ==22\*(C'\fR and not \f(CW\*(C`6 * 5 == 30\*(C'\fR..PP\&\fIOperator associativity\fR defines what happens if a sequence of thesame operators is used one after another: whether the evaluator willevaluate the left operations first or the right. For example, in \f(CW\*(C`8\&\- 4 \- 2\*(C'\fR, subtraction is left associative so Perl evaluates theexpression left to right. \f(CW\*(C`8 \- 4\*(C'\fR is evaluated first making theexpression \f(CW\*(C`4 \- 2 == 2\*(C'\fR and not \f(CW\*(C`8 \- 2 == 6\*(C'\fR..PPPerl operators have the following associativity and precedence,listed from highest precedence to lowest. Operators borrowed fromC keep the same precedence relationship with each other, even whereC's precedence is slightly screwy. (This makes learning Perl easierfor C folks.) With very few exceptions, these all operate on scalarvalues only, not array values..PP.Vb 10\& left terms and list operators (leftward)\& left \->\& nonassoc ++ \-\-\& right **\& right ! ~ \e and unary + and \-\& left =~ !~\& left * / % x\& left + \- .\& left << >>\& nonassoc named unary operators\& nonassoc < > <= >= lt gt le ge\& nonassoc == != <=> eq ne cmp ~~\& left &\& left | ^\& left &&\& left || //\& nonassoc .. ...\& right ?:\& right = += \-= *= etc.\& left , =>\& nonassoc list operators (rightward)\& right not\& left and\& left or xor.Ve.PPIn the following sections, these operators are covered in precedence order..PPMany operators can be overloaded for objects. See overload..Sh "Terms and List Operators (Leftward)".IX Xref "list operator operator, list term".IX Subsection "Terms and List Operators (Leftward)"A \s-1TERM\s0 has the highest precedence in Perl. They include variables,quote and quote-like operators, any expression in parentheses,and any function whose arguments are parenthesized. Actually, therearen't really functions in this sense, just list operators and unaryoperators behaving as functions because you put parentheses aroundthe arguments. These are all documented in perlfunc..PPIf any list operator (\fIprint()\fR, etc.) or any unary operator (\fIchdir()\fR, etc.)is followed by a left parenthesis as the next token, the operator andarguments within parentheses are taken to be of highest precedence,just like a normal function call..PPIn the absence of parentheses, the precedence of list operators such as\&\f(CW\*(C`print\*(C'\fR, \f(CW\*(C`sort\*(C'\fR, or \f(CW\*(C`chmod\*(C'\fR is either very high or very low depending onwhether you are looking at the left side or the right side of the operator.For example, in.PP.Vb 2\& @ary = (1, 3, sort 4, 2);\& print @ary; # prints 1324.Ve.PPthe commas on the right of the sort are evaluated before the sort,but the commas on the left are evaluated after. In other words,list operators tend to gobble up all arguments that follow, andthen act like a simple \s-1TERM\s0 with regard to the preceding expression.Be careful with parentheses:.PP.Vb 3\& # These evaluate exit before doing the print:\& print($foo, exit); # Obviously not what you want.\& print $foo, exit; # Nor is this.\&\& # These do the print before evaluating exit:\& (print $foo), exit; # This is what you want.\& print($foo), exit; # Or this.\& print ($foo), exit; # Or even this..Ve.PPAlso note that.PP.Vb 1\& print ($foo & 255) + 1, "\en";.Ve.PPprobably doesn't do what you expect at first glance. The parenthesesenclose the argument list for \f(CW\*(C`print\*(C'\fR which is evaluated (printingthe result of \f(CW\*(C`$foo & 255\*(C'\fR). Then one is added to the return valueof \f(CW\*(C`print\*(C'\fR (usually 1). The result is something like this:.PP.Vb 1\& 1 + 1, "\en"; # Obviously not what you meant..Ve.PPTo do what you meant properly, you must write:.PP.Vb 1\& print(($foo & 255) + 1, "\en");.Ve.PPSee \*(L"Named Unary Operators\*(R" for more discussion of this..PPAlso parsed as terms are the \f(CW\*(C`do {}\*(C'\fR and \f(CW\*(C`eval {}\*(C'\fR constructs, aswell as subroutine and method calls, and the anonymousconstructors \f(CW\*(C`[]\*(C'\fR and \f(CW\*(C`{}\*(C'\fR..PPSee also \*(L"Quote and Quote-like Operators\*(R" toward the end of this section,as well as \*(L"I/O Operators\*(R"..Sh "The Arrow Operator".IX Xref "arrow dereference ->".IX Subsection "The Arrow Operator""\f(CW\*(C`\->\*(C'\fR" is an infix dereference operator, just as it is in Cand \*(C+. If the right side is either a \f(CW\*(C`[...]\*(C'\fR, \f(CW\*(C`{...}\*(C'\fR, or a\&\f(CW\*(C`(...)\*(C'\fR subscript, then the left side must be either a hard orsymbolic reference to an array, a hash, or a subroutine respectively.(Or technically speaking, a location capable of holding a hardreference, if it's an array or hash reference being used forassignment.) See perlreftut and perlref..PPOtherwise, the right side is a method name or a simple scalarvariable containing either the method name or a subroutine reference,and the left side must be either an object (a blessed reference)or a class name (that is, a package name). See perlobj..Sh "Auto-increment and Auto-decrement".IX Xref "increment auto-increment ++ decrement auto-decrement --".IX Subsection "Auto-increment and Auto-decrement"\&\*(L"++\*(R" and \*(L"\-\-\*(R" work as in C. That is, if placed before a variable,they increment or decrement the variable by one before returning thevalue, and if placed after, increment or decrement after returning thevalue..PP.Vb 3\& $i = 0; $j = 0;\& print $i++; # prints 0\& print ++$j; # prints 1.Ve.PPNote that just as in C, Perl doesn't define \fBwhen\fR the variable isincremented or decremented. You just know it will be done sometimebefore or after the value is returned. This also means that modifyinga variable twice in the same statement will lead to undefined behaviour.Avoid statements like:.PP.Vb 2\& $i = $i ++;\& print ++ $i + $i ++;.Ve.PPPerl will not guarantee what the result of the above statements is..PPThe auto-increment operator has a little extra builtin magic to it. Ifyou increment a variable that is numeric, or that has ever been used ina numeric context, you get a normal increment. If, however, thevariable has been used in only string contexts since it was set, andhas a value that is not the empty string and matches the pattern\&\f(CW\*(C`/^[a\-zA\-Z]*[0\-9]*\ez/\*(C'\fR, the increment is done as a string, preserving eachcharacter within its range, with carry:.PP
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?