home *** CD-ROM | disk | FTP | other *** search
/ Chip: Windows 2000 Professional Resource Kit / W2KPRK.iso / apps / perl / ActivePerl.exe / data.z / perlop.pod < prev    next >
Encoding:
Text File  |  1999-10-14  |  70.5 KB  |  1,006 lines

  1. =head1 NAME
  2.  
  3. perlop - Perl operators and precedence
  4.  
  5. =head1 SYNOPSIS
  6.  
  7. Perl operators have the following associativity and precedence,
  8. listed from highest precedence to lowest.  Note that all operators
  9. borrowed from C keep the same precedence relationship with each other,
  10. even where C's precedence is slightly screwy.  (This makes learning
  11. Perl easier for C folks.)  With very few exceptions, these all
  12. operate on scalar values only, not array values.
  13.  
  14.     left    terms and list operators (leftward)
  15.     left    ->
  16.     nonassoc    ++ --
  17.     right    **
  18.     right    ! ~ \ and unary + and -
  19.     left    =~ !~
  20.     left    * / % x
  21.     left    + - .
  22.     left    << >>
  23.     nonassoc    named unary operators
  24.     nonassoc    < > <= >= lt gt le ge
  25.     nonassoc    == != <=> eq ne cmp
  26.     left    &
  27.     left    | ^
  28.     left    &&
  29.     left    ||
  30.     nonassoc    ..  ...
  31.     right    ?:
  32.     right    = += -= *= etc.
  33.     left    , =>
  34.     nonassoc    list operators (rightward)
  35.     right    not
  36.     left    and
  37.     left    or xor
  38.  
  39. In the following sections, these operators are covered in precedence order.
  40.  
  41. Many operators can be overloaded for objects.  See L<overload>.
  42.  
  43. =head1 DESCRIPTION
  44.  
  45. =head2 Terms and List Operators (Leftward)
  46.  
  47. A TERM has the highest precedence in Perl.  They include variables,
  48. quote and quote-like operators, any expression in parentheses,
  49. and any function whose arguments are parenthesized.  Actually, there
  50. aren't really functions in this sense, just list operators and unary
  51. operators behaving as functions because you put parentheses around
  52. the arguments.  These are all documented in L<perlfunc>.
  53.  
  54. If any list operator (print(), etc.) or any unary operator (chdir(), etc.)
  55. is followed by a left parenthesis as the next token, the operator and
  56. arguments within parentheses are taken to be of highest precedence,
  57. just like a normal function call.
  58.  
  59. In the absence of parentheses, the precedence of list operators such as
  60. C<print>, C<sort>, or C<chmod> is either very high or very low depending on
  61. whether you are looking at the left side or the right side of the operator.
  62. For example, in
  63.  
  64.     @ary = (1, 3, sort 4, 2);
  65.     print @ary;        # prints 1324
  66.  
  67. the commas on the right of the sort are evaluated before the sort, but
  68. the commas on the left are evaluated after.  In other words, list
  69. operators tend to gobble up all the arguments that follow them, and
  70. then act like a simple TERM with regard to the preceding expression.
  71. Note that you have to be careful with parentheses:
  72.  
  73.     # These evaluate exit before doing the print:
  74.     print($foo, exit);    # Obviously not what you want.
  75.     print $foo, exit;    # Nor is this.
  76.  
  77.     # These do the print before evaluating exit:
  78.     (print $foo), exit;    # This is what you want.
  79.     print($foo), exit;    # Or this.
  80.     print ($foo), exit;    # Or even this.
  81.  
  82. Also note that
  83.  
  84.     print ($foo & 255) + 1, "\n";
  85.  
  86. probably doesn't do what you expect at first glance.  See
  87. L<Named Unary Operators> for more discussion of this.
  88.  
  89. Also parsed as terms are the C<do {}> and C<eval {}> constructs, as
  90. well as subroutine and method calls, and the anonymous
  91. constructors C<[]> and C<{}>.
  92.  
  93. See also L<Quote and Quote-like Operators> toward the end of this section,
  94. as well as L<"I/O Operators">.
  95.  
  96. =head2 The Arrow Operator
  97.  
  98. Just as in C and C++, "C<-E<gt>>" is an infix dereference operator.  If the
  99. right side is either a C<[...]> or C<{...}> subscript, then the left side
  100. must be either a hard or symbolic reference to an array or hash (or
  101. a location capable of holding a hard reference, if it's an lvalue (assignable)).
  102. See L<perlref>.
  103.  
  104. Otherwise, the right side is a method name or a simple scalar variable
  105. containing the method name, and the left side must either be an object
  106. (a blessed reference) or a class name (that is, a package name).
  107. See L<perlobj>.
  108.  
  109. =head2 Auto-increment and Auto-decrement
  110.  
  111. "++" and "--" work as in C.  That is, if placed before a variable, they
  112. increment or decrement the variable before returning the value, and if
  113. placed after, increment or decrement the variable after returning the value.
  114.  
  115. The auto-increment operator has a little extra builtin magic to it.  If
  116. you increment a variable that is numeric, or that has ever been used in
  117. a numeric context, you get a normal increment.  If, however, the
  118. variable has been used in only string contexts since it was set, and
  119. has a value that is not the empty string and matches the pattern
  120. C</^[a-zA-Z]*[0-9]*$/>, the increment is done as a string, preserving each
  121. character within its range, with carry:
  122.  
  123.     print ++($foo = '99');    # prints '100'
  124.     print ++($foo = 'a0');    # prints 'a1'
  125.     print ++($foo = 'Az');    # prints 'Ba'
  126.     print ++($foo = 'zz');    # prints 'aaa'
  127.  
  128. The auto-decrement operator is not magical.
  129.  
  130. =head2 Exponentiation
  131.  
  132. Binary "**" is the exponentiation operator.  Note that it binds even more
  133. tightly than unary minus, so -2**4 is -(2**4), not (-2)**4. (This is
  134. implemented using C's pow(3) function, which actually works on doubles
  135. internally.)
  136.  
  137. =head2 Symbolic Unary Operators
  138.  
  139. Unary "!" performs logical negation, i.e., "not".  See also C<not> for a lower
  140. precedence version of this.
  141.  
  142. Unary "-" performs arithmetic negation if the operand is numeric.  If
  143. the operand is an identifier, a string consisting of a minus sign
  144. concatenated with the identifier is returned.  Otherwise, if the string
  145. starts with a plus or minus, a string starting with the opposite sign
  146. is returned.  One effect of these rules is that C<-bareword> is equivalent
  147. to C<"-bareword">.
  148.  
  149. Unary "~" performs bitwise negation, i.e., 1's complement.  For example,
  150. C<0666 &~ 027> is 0640.  (See also L<Integer Arithmetic> and L<Bitwise
  151. String Operators>.)
  152.  
  153. Unary "+" has no effect whatsoever, even on strings.  It is useful
  154. syntactically for separating a function name from a parenthesized expression
  155. that would otherwise be interpreted as the complete list of function
  156. arguments.  (See examples above under L<Terms and List Operators (Leftward)>.)
  157.  
  158. Unary "\" creates a reference to whatever follows it.  See L<perlref>.
  159. Do not confuse this behavior with the behavior of backslash within a
  160. string, although both forms do convey the notion of protecting the next
  161. thing from interpretation.
  162.  
  163. =head2 Binding Operators
  164.  
  165. Binary "=~" binds a scalar expression to a pattern match.  Certain operations
  166. search or modify the string $_ by default.  This operator makes that kind
  167. of operation work on some other string.  The right argument is a search
  168. pattern, substitution, or transliteration.  The left argument is what is
  169. supposed to be searched, substituted, or transliterated instead of the default
  170. $_.  The return value indicates the success of the operation.  (If the
  171. right argument is an expression rather than a search pattern,
  172. substitution, or transliteration, it is interpreted as a search pattern at run
  173. time.  This can be is less efficient than an explicit search, because the
  174. pattern must be compiled every time the expression is evaluated.
  175.  
  176. Binary "!~" is just like "=~" except the return value is negated in
  177. the logical sense.
  178.  
  179. =head2 Multiplicative Operators
  180.  
  181. Binary "*" multiplies two numbers.
  182.  
  183. Binary "/" divides two numbers.
  184.  
  185. Binary "%" computes the modulus of two numbers.  Given integer
  186. operands C<$a> and C<$b>: If C<$b> is positive, then C<$a % $b> is
  187. C<$a> minus the largest multiple of C<$b> that is not greater than
  188. C<$a>.  If C<$b> is negative, then C<$a % $b> is C<$a> minus the
  189. smallest multiple of C<$b> that is not less than C<$a> (i.e. the
  190. result will be less than or equal to zero). 
  191. Note than when C<use integer> is in scope, "%" give you direct access
  192. to the modulus operator as implemented by your C compiler.  This
  193. operator is not as well defined for negative operands, but it will
  194. execute faster.
  195.  
  196. Binary "x" is the repetition operator.  In scalar context, it
  197. returns a string consisting of the left operand repeated the number of
  198. times specified by the right operand.  In list context, if the left
  199. operand is a list in parentheses, it repeats the list.
  200.  
  201.     print '-' x 80;        # print row of dashes
  202.  
  203.     print "\t" x ($tab/8), ' ' x ($tab%8);    # tab over
  204.  
  205.     @ones = (1) x 80;        # a list of 80 1's
  206.     @ones = (5) x @ones;    # set all elements to 5
  207.  
  208.  
  209. =head2 Additive Operators
  210.  
  211. Binary "+" returns the sum of two numbers.
  212.  
  213. Binary "-" returns the difference of two numbers.
  214.  
  215. Binary "." concatenates two strings.
  216.  
  217. =head2 Shift Operators
  218.  
  219. Binary "<<" returns the value of its left argument shifted left by the
  220. number of bits specified by the right argument.  Arguments should be
  221. integers.  (See also L<Integer Arithmetic>.)
  222.  
  223. Binary ">>" returns the value of its left argument shifted right by
  224. the number of bits specified by the right argument.  Arguments should
  225. be integers.  (See also L<Integer Arithmetic>.)
  226.  
  227. =head2 Named Unary Operators
  228.  
  229. The various named unary operators are treated as functions with one
  230. argument, with optional parentheses.  These include the filetest
  231. operators, like C<-f>, C<-M>, etc.  See L<perlfunc>.
  232.  
  233. If any list operator (print(), etc.) or any unary operator (chdir(), etc.)
  234. is followed by a left parenthesis as the next token, the operator and
  235. arguments within parentheses are taken to be of highest precedence,
  236. just like a normal function call.  Examples:
  237.  
  238.     chdir $foo    || die;    # (chdir $foo) || die
  239.     chdir($foo)   || die;    # (chdir $foo) || die
  240.     chdir ($foo)  || die;    # (chdir $foo) || die
  241.     chdir +($foo) || die;    # (chdir $foo) || die
  242.  
  243. but, because * is higher precedence than ||:
  244.  
  245.     chdir $foo * 20;    # chdir ($foo * 20)
  246.     chdir($foo) * 20;    # (chdir $foo) * 20
  247.     chdir ($foo) * 20;    # (chdir $foo) * 20
  248.     chdir +($foo) * 20;    # chdir ($foo * 20)
  249.  
  250.     rand 10 * 20;    # rand (10 * 20)
  251.     rand(10) * 20;    # (rand 10) * 20
  252.     rand (10) * 20;    # (rand 10) * 20
  253.     rand +(10) * 20;    # rand (10 * 20)
  254.  
  255. See also L<"Terms and List Operators (Leftward)">.
  256.  
  257. =head2 Relational Operators
  258.  
  259. Binary "E<lt>" returns true if the left argument is numerically less than
  260. the right argument.
  261.  
  262. Binary "E<gt>" returns true if the left argument is numerically greater
  263. than the right argument.
  264.  
  265. Binary "E<lt>=" returns true if the left argument is numerically less than
  266. or equal to the right argument.
  267.  
  268. Binary "E<gt>=" returns true if the left argument is numerically greater
  269. than or equal to the right argument.
  270.  
  271. Binary "lt" returns true if the left argument is stringwise less than
  272. the right argument.
  273.  
  274. Binary "gt" returns true if the left argument is stringwise greater
  275. than the right argument.
  276.  
  277. Binary "le" returns true if the left argument is stringwise less than
  278. or equal to the right argument.
  279.  
  280. Binary "ge" returns true if the left argument is stringwise greater
  281. than or equal to the right argument.
  282.  
  283. =head2 Equality Operators
  284.  
  285. Binary "==" returns true if the left argument is numerically equal to
  286. the right argument.
  287.  
  288. Binary "!=" returns true if the left argument is numerically not equal
  289. to the right argument.
  290.  
  291. Binary "E<lt>=E<gt>" returns -1, 0, or 1 depending on whether the left
  292. argument is numerically less than, equal to, or greater than the right
  293. argument.
  294.  
  295. Binary "eq" returns true if the left argument is stringwise equal to
  296. the right argument.
  297.  
  298. Binary "ne" returns true if the left argument is stringwise not equal
  299. to the right argument.
  300.  
  301. Binary "cmp" returns -1, 0, or 1 depending on whether the left argument is stringwise
  302. less than, equal to, or greater than the right argument.
  303.  
  304. "lt", "le", "ge", "gt" and "cmp" use the collation (sort) order specified
  305. by the current locale if C<use locale> is in effect.  See L<perllocale>.
  306.  
  307. =head2 Bitwise And
  308.  
  309. Binary "&" returns its operators ANDed together bit by bit.
  310. (See also L<Integer Arithmetic> and L<Bitwise String Operators>.)
  311.  
  312. =head2 Bitwise Or and Exclusive Or
  313.  
  314. Binary "|" returns its operators ORed together bit by bit.
  315. (See also L<Integer Arithmetic> and L<Bitwise String Operators>.)
  316.  
  317. Binary "^" returns its operators XORed together bit by bit.
  318. (See also L<Integer Arithmetic> and L<Bitwise String Operators>.)
  319.  
  320. =head2 C-style Logical And
  321.  
  322. Binary "&&" performs a short-circuit logical AND operation.  That is,
  323. if the left operand is false, the right operand is not even evaluated.
  324. Scalar or list context propagates down to the right operand if it
  325. is evaluated.
  326.  
  327. =head2 C-style Logical Or
  328.  
  329. Binary "||" performs a short-circuit logical OR operation.  That is,
  330. if the left operand is true, the right operand is not even evaluated.
  331. Scalar or list context propagates down to the right operand if it
  332. is evaluated.
  333.  
  334. The C<||> and C<&&> operators differ from C's in that, rather than returning
  335. 0 or 1, they return the last value evaluated.  Thus, a reasonably portable
  336. way to find out the home directory (assuming it's not "0") might be:
  337.  
  338.     $home = $ENV{'HOME'} || $ENV{'LOGDIR'} ||
  339.     (getpwuid($<))[7] || die "You're homeless!\n";
  340.  
  341. In particular, this means that you shouldn't use this
  342. for selecting between two aggregates for assignment:
  343.  
  344.     @a = @b || @c;        # this is wrong
  345.     @a = scalar(@b) || @c;    # really meant this
  346.     @a = @b ? @b : @c;        # this works fine, though
  347.  
  348. As more readable alternatives to C<&&> and C<||> when used for
  349. control flow, Perl provides C<and> and C<or> operators (see below).
  350. The short-circuit behavior is identical.  The precedence of "and" and
  351. "or" is much lower, however, so that you can safely use them after a
  352. list operator without the need for parentheses:
  353.  
  354.     unlink "alpha", "beta", "gamma"
  355.         or gripe(), next LINE;
  356.  
  357. With the C-style operators that would have been written like this:
  358.  
  359.     unlink("alpha", "beta", "gamma")
  360.         || (gripe(), next LINE);
  361.  
  362. Use "or" for assignment is unlikely to do what you want; see below.
  363.  
  364. =head2 Range Operators
  365.  
  366. Binary ".." is the range operator, which is really two different
  367. operators depending on the context.  In list context, it returns an
  368. array of values counting (by ones) from the left value to the right
  369. value.  This is useful for writing C<foreach (1..10)> loops and for
  370. doing slice operations on arrays.  In the current implementation, no
  371. temporary array is created when the range operator is used as the
  372. expression in C<foreach> loops, but older versions of Perl might burn
  373. a lot of memory when you write something like this:
  374.  
  375.     for (1 .. 1_000_000) {
  376.     # code
  377.     }
  378.  
  379. In scalar context, ".." returns a boolean value.  The operator is
  380. bistable, like a flip-flop, and emulates the line-range (comma) operator
  381. of B<sed>, B<awk>, and various editors.  Each ".." operator maintains its
  382. own boolean state.  It is false as long as its left operand is false.
  383. Once the left operand is true, the range operator stays true until the
  384. right operand is true, I<AFTER> which the range operator becomes false
  385. again.  (It doesn't become false till the next time the range operator is
  386. evaluated.  It can test the right operand and become false on the same
  387. evaluation it became true (as in B<awk>), but it still returns true once.
  388. If you don't want it to test the right operand till the next evaluation
  389. (as in B<sed>), use three dots ("...") instead of two.)  The right
  390. operand is not evaluated while the operator is in the "false" state, and
  391. the left operand is not evaluated while the operator is in the "true"
  392. state.  The precedence is a little lower than || and &&.  The value
  393. returned is either the empty string for false, or a sequence number
  394. (beginning with 1) for true.  The sequence number is reset for each range
  395. encountered.  The final sequence number in a range has the string "E0"
  396. appended to it, which doesn't affect its numeric value, but gives you
  397. something to search for if you want to exclude the endpoint.  You can
  398. exclude the beginning point by waiting for the sequence number to be
  399. greater than 1.  If either operand of scalar ".." is a constant expression,
  400. that operand is implicitly compared to the C<$.> variable, the current
  401. line number.  Examples:
  402.  
  403. As a scalar operator:
  404.  
  405.     if (101 .. 200) { print; }    # print 2nd hundred lines
  406.     next line if (1 .. /^$/);    # skip header lines
  407.     s/^/> / if (/^$/ .. eof());    # quote body
  408.  
  409.     # parse mail messages
  410.     while (<>) {
  411.         $in_header =   1  .. /^$/;
  412.         $in_body   = /^$/ .. eof();
  413.     # do something based on those
  414.     } continue {
  415.     close ARGV if eof;         # reset $. each file
  416.     }
  417.  
  418. As a list operator:
  419.  
  420.     for (101 .. 200) { print; }    # print $_ 100 times
  421.     @foo = @foo[0 .. $#foo];    # an expensive no-op
  422.     @foo = @foo[$#foo-4 .. $#foo];    # slice last 5 items
  423.  
  424. The range operator (in list context) makes use of the magical
  425. auto-increment algorithm if the operands are strings.  You
  426. can say
  427.  
  428.     @alphabet = ('A' .. 'Z');
  429.  
  430. to get all the letters of the alphabet, or
  431.  
  432.     $hexdigit = (0 .. 9, 'a' .. 'f')[$num & 15];
  433.  
  434. to get a hexadecimal digit, or
  435.  
  436.     @z2 = ('01' .. '31');  print $z2[$mday];
  437.  
  438. to get dates with leading zeros.  If the final value specified is not
  439. in the sequence that the magical increment would produce, the sequence
  440. goes until the next value would be longer than the final value
  441. specified.
  442.  
  443. =head2 Conditional Operator
  444.  
  445. Ternary "?:" is the conditional operator, just as in C.  It works much
  446. like an if-then-else.  If the argument before the ? is true, the
  447. argument before the : is returned, otherwise the argument after the :
  448. is returned.  For example:
  449.  
  450.     printf "I have %d dog%s.\n", $n,
  451.         ($n == 1) ? '' : "s";
  452.  
  453. Scalar or list context propagates downward into the 2nd
  454. or 3rd argument, whichever is selected.
  455.  
  456.     $a = $ok ? $b : $c;  # get a scalar
  457.     @a = $ok ? @b : @c;  # get an array
  458.     $a = $ok ? @b : @c;  # oops, that's just a count!
  459.  
  460. The operator may be assigned to if both the 2nd and 3rd arguments are
  461. legal lvalues (meaning that you can assign to them):
  462.  
  463.     ($a_or_b ? $a : $b) = $c;
  464.  
  465. This is not necessarily guaranteed to contribute to the readability of your program.
  466.  
  467. Because this operator produces an assignable result, using assignments
  468. without parentheses will get you in trouble.  For example, this:
  469.  
  470.     $a % 2 ? $a += 10 : $a += 2
  471.  
  472. Really means this:
  473.  
  474.     (($a % 2) ? ($a += 10) : $a) += 2
  475.  
  476. Rather than this:
  477.  
  478.     ($a % 2) ? ($a += 10) : ($a += 2)
  479.  
  480. =head2 Assignment Operators
  481.  
  482. "=" is the ordinary assignment operator.
  483.  
  484. Assignment operators work as in C.  That is,
  485.  
  486.     $a += 2;
  487.  
  488. is equivalent to
  489.  
  490.     $a = $a + 2;
  491.  
  492. although without duplicating any side effects that dereferencing the lvalue
  493. might trigger, such as from tie().  Other assignment operators work similarly.
  494. The following are recognized:
  495.  
  496.     **=    +=    *=    &=    <<=    &&=
  497.            -=    /=    |=    >>=    ||=
  498.            .=    %=    ^=
  499.              x=
  500.  
  501. Note that while these are grouped by family, they all have the precedence
  502. of assignment.
  503.  
  504. Unlike in C, the assignment operator produces a valid lvalue.  Modifying
  505. an assignment is equivalent to doing the assignment and then modifying
  506. the variable that was assigned to.  This is useful for modifying
  507. a copy of something, like this:
  508.  
  509.     ($tmp = $global) =~ tr [A-Z] [a-z];
  510.  
  511. Likewise,
  512.  
  513.     ($a += 2) *= 3;
  514.  
  515. is equivalent to
  516.  
  517.     $a += 2;
  518.     $a *= 3;
  519.  
  520. =head2 Comma Operator
  521.  
  522. Binary "," is the comma operator.  In scalar context it evaluates
  523. its left argument, throws that value away, then evaluates its right
  524. argument and returns that value.  This is just like C's comma operator.
  525.  
  526. In list context, it's just the list argument separator, and inserts
  527. both its arguments into the list.
  528.  
  529. The =E<gt> digraph is mostly just a synonym for the comma operator.  It's useful for
  530. documenting arguments that come in pairs.  As of release 5.001, it also forces
  531. any word to the left of it to be interpreted as a string.
  532.  
  533. =head2 List Operators (Rightward)
  534.  
  535. On the right side of a list operator, it has very low precedence,
  536. such that it controls all comma-separated expressions found there.
  537. The only operators with lower precedence are the logical operators
  538. "and", "or", and "not", which may be used to evaluate calls to list
  539. operators without the need for extra parentheses:
  540.  
  541.     open HANDLE, "filename"
  542.     or die "Can't open: $!\n";
  543.  
  544. See also discussion of list operators in L<Terms and List Operators (Leftward)>.
  545.  
  546. =head2 Logical Not
  547.  
  548. Unary "not" returns the logical negation of the expression to its right.
  549. It's the equivalent of "!" except for the very low precedence.
  550.  
  551. =head2 Logical And
  552.  
  553. Binary "and" returns the logical conjunction of the two surrounding
  554. expressions.  It's equivalent to && except for the very low
  555. precedence.  This means that it short-circuits: i.e., the right
  556. expression is evaluated only if the left expression is true.
  557.  
  558. =head2 Logical or and Exclusive Or
  559.  
  560. Binary "or" returns the logical disjunction of the two surrounding
  561. expressions.  It's equivalent to || except for the very low precedence.
  562. This makes it useful for control flow
  563.  
  564.     print FH $data        or die "Can't write to FH: $!";
  565.  
  566. This means that it short-circuits: i.e., the right expression is evaluated
  567. only if the left expression is false.  Due to its precedence, you should
  568. probably avoid using this for assignment, only for control flow.
  569.  
  570.     $a = $b or $c;        # bug: this is wrong
  571.     ($a = $b) or $c;        # really means this
  572.     $a = $b || $c;        # better written this way
  573.  
  574. However, when it's a list context assignment and you're trying to use
  575. "||" for control flow, you probably need "or" so that the assignment
  576. takes higher precedence.
  577.  
  578.     @info = stat($file) || die;     # oops, scalar sense of stat!
  579.     @info = stat($file) or die;     # better, now @info gets its due
  580.  
  581. Then again, you could always use parentheses.
  582.  
  583. Binary "xor" returns the exclusive-OR of the two surrounding expressions.
  584. It cannot short circuit, of course.
  585.  
  586. =head2 C Operators Missing From Perl
  587.  
  588. Here is what C has that Perl doesn't:
  589.  
  590. =over 8
  591.  
  592. =item unary &
  593.  
  594. Address-of operator.  (But see the "\" operator for taking a reference.)
  595.  
  596. =item unary *
  597.  
  598. Dereference-address operator. (Perl's prefix dereferencing
  599. operators are typed: $, @, %, and &.)
  600.  
  601. =item (TYPE)
  602.  
  603. Type casting operator.
  604.  
  605. =back
  606.  
  607. =head2 Quote and Quote-like Operators
  608.  
  609. While we usually think of quotes as literal values, in Perl they
  610. function as operators, providing various kinds of interpolating and
  611. pattern matching capabilities.  Perl provides customary quote characters
  612. for these behaviors, but also provides a way for you to choose your
  613. quote character for any of them.  In the following table, a C<{}> represents
  614. any pair of delimiters you choose.  Non-bracketing delimiters use
  615. the same character fore and aft, but the 4 sorts of brackets
  616. (round, angle, square, curly) will all nest.
  617.  
  618.     Customary  Generic        Meaning         Interpolates
  619.     ''     q{}          Literal          no
  620.     ""    qq{}          Literal          yes
  621.     ``    qx{}          Command          yes (unless '' is delimiter)
  622.         qw{}         Word list          no
  623.     //     m{}       Pattern match      yes (unless '' is delimiter)
  624.         qr{}          Pattern          yes (unless '' is delimiter)
  625.          s{}{}        Substitution      yes (unless '' is delimiter)
  626.         tr{}{}      Transliteration      no (but see below)
  627.  
  628. Note that there can be whitespace between the operator and the quoting
  629. characters, except when C<#> is being used as the quoting character.
  630. C<q#foo#> is parsed as being the string C<foo>, while C<q #foo#> is the
  631. operator C<q> followed by a comment. Its argument will be taken from the
  632. next line. This allows you to write:
  633.  
  634.     s {foo}  # Replace foo
  635.       {bar}  # with bar.
  636.  
  637. For constructs that do interpolation, variables beginning with "C<$>"
  638. or "C<@>" are interpolated, as are the following sequences. Within
  639. a transliteration, the first ten of these sequences may be used.
  640.  
  641.     \t        tab             (HT, TAB)
  642.     \n        newline         (NL)
  643.     \r        return          (CR)
  644.     \f        form feed       (FF)
  645.     \b        backspace       (BS)
  646.     \a        alarm (bell)    (BEL)
  647.     \e        escape          (ESC)
  648.     \033    octal char    (ESC)
  649.     \x1b    hex char    (ESC)
  650.     \c[        control char
  651.  
  652.     \l        lowercase next char
  653.     \u        uppercase next char
  654.     \L        lowercase till \E
  655.     \U        uppercase till \E
  656.     \E        end case modification
  657.     \Q        quote non-word characters till \E
  658.  
  659. If C<use locale> is in effect, the case map used by C<\l>, C<\L>, C<\u>
  660. and C<\U> is taken from the current locale.  See L<perllocale>.
  661.  
  662. All systems use the virtual C<"\n"> to represent a line terminator,
  663. called a "newline".  There is no such thing as an unvarying, physical
  664. newline character.  It is an illusion that the operating system,
  665. device drivers, C libraries, and Perl all conspire to preserve.  Not all
  666. systems read C<"\r"> as ASCII CR and C<"\n"> as ASCII LF.  For example,
  667. on a Mac, these are reversed, and on systems without line terminator,
  668. printing C<"\n"> may emit no actual data.  In general, use C<"\n"> when
  669. you mean a "newline" for your system, but use the literal ASCII when you
  670. need an exact character.  For example, most networking protocols expect
  671. and prefer a CR+LF (C<"\012\015"> or C<"\cJ\cM">) for line terminators,
  672. and although they often accept just C<"\012">, they seldom tolerate just
  673. C<"\015">.  If you get in the habit of using C<"\n"> for networking,
  674. you may be burned some day.
  675.  
  676. You cannot include a literal C<$> or C<@> within a C<\Q> sequence. 
  677. An unescaped C<$> or C<@> interpolates the corresponding variable, 
  678. while escaping will cause the literal string C<\$> to be inserted.
  679. You'll need to write something like C<m/\Quser\E\@\Qhost/>. 
  680.  
  681. Patterns are subject to an additional level of interpretation as a
  682. regular expression.  This is done as a second pass, after variables are
  683. interpolated, so that regular expressions may be incorporated into the
  684. pattern from the variables.  If this is not what you want, use C<\Q> to
  685. interpolate a variable literally.
  686.  
  687. Apart from the above, there are no multiple levels of interpolation.  In
  688. particular, contrary to the expectations of shell programmers, back-quotes
  689. do I<NOT> interpolate within double quotes, nor do single quotes impede
  690. evaluation of variables when used within double quotes.
  691.  
  692. =head2 Regexp Quote-Like Operators
  693.  
  694. Here are the quote-like operators that apply to pattern
  695. matching and related activities.
  696.  
  697. Most of this section is related to use of regular expressions from Perl.
  698. Such a use may be considered from two points of view: Perl handles a
  699. a string and a "pattern" to RE (regular expression) engine to match, 
  700. RE engine finds (or does not find) the match, and Perl uses the findings 
  701. of RE engine for its operation, possibly asking the engine for other matches.
  702.  
  703. RE engine has no idea what Perl is going to do with what it finds, 
  704. similarly, the rest of Perl has no idea what a particular regular expression 
  705. means to RE engine.  This creates a clean separation, and in this section
  706. we discuss matching from Perl point of view only.  The other point of
  707. view may be found in L<perlre>.
  708.  
  709. =over 8
  710.  
  711. =item ?PATTERN?
  712.  
  713. This is just like the C</pattern/> search, except that it matches only
  714. once between calls to the reset() operator.  This is a useful
  715. optimization when you want to see only the first occurrence of
  716. something in each file of a set of files, for instance.  Only C<??>
  717. patterns local to the current package are reset.
  718.  
  719.     while (<>) {
  720.     if (?^$?) {
  721.                 # blank line between header and body
  722.     }
  723.     } continue {
  724.     reset if eof;        # clear ?? status for next file
  725.     }
  726.  
  727. This usage is vaguely deprecated, and may be removed in some future
  728. version of Perl.
  729.  
  730. =item m/PATTERN/cgimosx
  731.  
  732. =item /PATTERN/cgimosx
  733.  
  734. Searches a string for a pattern match, and in scalar context returns
  735. true (1) or false ('').  If no string is specified via the C<=~> or
  736. C<!~> operator, the $_ string is searched.  (The string specified with
  737. C<=~> need not be an lvalue--it may be the result of an expression
  738. evaluation, but remember the C<=~> binds rather tightly.)  See also
  739. L<perlre>.
  740. See L<perllocale> for discussion of additional considerations that apply
  741. when C<use locale> is in effect.
  742.  
  743. Options are:
  744.  
  745.     c    Do not reset search position on a failed match when /g is in effect.
  746.     g    Match globallylhein st nds, l conurrence ofs    g    Mi note ma-ertenion vettern match, a sp    g    Mm    Ttes ring and sltiple leve bes    g    Mo    Comp (<>tern maty thee be    g    Ms    Ttes ring and slgle quoe be    g    Mx    Usxpec acdedgular expressions fr
  747. Optno "/" in  C<=dee mrall  C<he hab bon C<$> ms in opnal co(ThW wha C<=~>msou maycased w exy>teir addnl -copdleus, ic,dnl -le  a kagharacter.  
  748. of  sldee mrall Ifs is a uticular retheful
  749. or disching froUbox>terha cm
  750. do t apptextaeff"/", an avoid LTS (n se to doer plakstend Pee Ifno "?" ino t <=dee mrall,  C<he habching-y th-e betruof a s?>
  751. TERN?
  752.  
  753. >ply
  754. .
  755.  
  756. Mno "'" in  C<=dee mrall,dnlriable literpolation.   a utol dimedgohe haattERN?
  757.  
  758. OpttERN?
  759. y be textaeffiables wh,ile when caubiterpolationedg( in 
  760. pattern froateomp (<thels to timhe restern frorch posa uluation andept that diswC<he habdee mrall a usegle quotes i(TheNs iat app> o)>d in > o|soumtly.t be an erpolationedganse the liycalokke theacd-of-ing and a ts.)
  761. Mno  want to s a usetern frobe inseomp (<tty thee be,ditiC<\Q>/o>ter vao t <=ry  ( anddee mrallThis is avoidspectaniovetrun-timheateomp (ons thyou in sseful
  762. orwC<he habue--i  wan reserpolation.will t'taracwiof ╗.nexracwan resexyƒ<he ha ctaniovetrun-timheateomp (ons thyou in sseful
  763. orwC<he habue--i  wan reserp9Howll ati tn ╗.n\@\Qhop (o
  764.  
  765.  ╗tupoint o s<hseo t <=d=ry  ou in ssefulariable literher pouotes i(Tg is sldee ssefularimxra>.
  766.  
  767.  ou inll nant iions o t <  ou froateop> o)>d  see onlyimsey/" in   an lv(o" o t<ddeltisyƒ<ly>l
  768. optiin opnal co(ThW wha n resexd
  769.     forns o t <  ouhopg>-le  a part frosexd, 
  770. of// of nt larte C<=~> or
  771. C<!~RE elarte C<whsns th--i  wanubhis is not whaoptiinby pouoteine r ferher pouat diswC<p    g    M( ts1>, 
  772. o$2>, 
  773. o$3>...)okke theacd-ofthe e ts1>coop.timhraconskagepecificd-ofpointdi-errndles a
  774. a  4'ndbhd-viurrsidW ha cta activranooteine r ferher pouotes i(T to RE e
  775. C<!niovetr
  776. OpttElarte ttor> is erndeltisgharactely.tactoutoteine r fer,See amsey/larteidere
  777. C<!iinupperlnurr
  778.  
  779. ns o Examsterect.
  780.    d nn(TTY,S'/dev/s y');.
  781.    <TTY> =~ /^y/i && iso();    #rticisoy dedesi (rct.
  782.    e {
  783. /Vrches : *([0-9.]*)/set $arches a= $1;versio
  784.     somee {m#^/usr/sppol/udep#;rsio
  785.    #rppo plan'ndg (pio
  786.    $arga= she t;dy
  787.     }
  788.     } continupris ie {/$arg/o;    #ridspectniovetrun-ure
  789. versio
  790.    e {
  791. ($F1, $F2, $Etcon= ($isoy=~ /^(\S+)\s+(\S+)\s*(.*)/s)rsion of (o" co(amsteprelas n$isoyis otance.  Onltwicuo  redept thatlocls r ne--i  wal  Cpecifio"sig not onseomloce. eld see $F1, $F2, cifat$Etc?PATTER C<ions are:
  792. OpperaifIfs ible literhwa act"sig xd,    g    MifwC<he tern maty theerns o T ouhopg>-modion
  793. rpression
  794. satch, a>tern maty thee b--a usefr,Sy thee bdo t mfs ill tsC<=d ssiabletacter pouo" in  rp9Howefulbhd-vtsCPATen ofperltTER C<=~> g isn larte C<=~> ,efulr
  795. C<!~RE larte
  796. Oprch thatnub" in   whaoptiinby prch thoteine r ferher pouo opnal co(ThW wha .o t <  o activ nooteine r fer,efulr
  797. C<!~RE larte
  798. Oprch thwhaoptiiatn in   ,C<=di <  o acwa acteine r ferheiouept th}
  799. oacdedgularns o td via the C<=~> ,the cu~>ecutt.
  800.  
  801. O
  802. of//g>-fon of th} some is spatlo
  803. C<!s thTRUEdi <ime is ser,SeeptFALSEdi <  o acart fosxrdditi is s.o T ou st nds,ns than lv(o" ce ofs  mraitem adely.obalusQ>/o> ou s()rssxnc nds;.obn C<use sxnc/ s>g i Aonurrence ofs nrpo a s globash thatnylhein st nds, otanceitgQ>ns th--i  wan in   aperlldee mrahabchia usatby ptio>/o> ouhopc>-modion
  804. rp(e. rp
  805. of//gc>)okkModioyo>/o> outargetatn in  tions globash thllylhein st ndsns o Ydee mraateomme I
  806. of//g>- is seretactI
  807. of/\G.../g>estehe e t\Gdnl -E ezheo-tadctIt"she nds,  use is sereonlyixrhan st nds,tehe e> ou e viuusatiof//g>,aifIfs ,alefte
  808. f?PATTER t\Gdnt"she nds,art frosup rt
  809. evaluoutrltTERhopg>-modion
  810. r;  and st sp tactoutohopg>,R t\Gdnbhd-vtsCju" ctheeatio\A> aperl  us'ndrhc   hellSeeptmp (<ssefuler pouofer
  811.  
  812. ns o Examsterect.
  813.    # larte C<=~> .
  814.    ($C<e,$fati,$fas t hon= (`upll t`y=~ /(\d+\.\d+)pg);rsio
  815.    #rvia the C<=~> io
  816.    tinu on a $/n= "";rs    
  817.     }  foned($teiagiaphn=  coontinu
  818.     }
  819.     }$teiagiaphn=~ /[a-z]['")]*[.!?]+['")]*\spg)ntinu    $o    Ct slti++;inu
  820.     }ers    }ure
  821. verse
  822. vpris i"$o    Ct slti\n";rsio
  823.    #rusQ>/of//gcetactI\Gio
  824.    $_n= "p oqp qq";dy
  825.     }
  826.     }$i++   2)ntin
  827.     }e
  828. vpris i"1: '";dy
  829.     }e
  830. vpris i$1}
  831.     /(o)pgc;vpris i"',n s=",n s,n"\n";rs
  832.     }e
  833. vpris i"2: '";dy
  834.     }e
  835. vpris i$1}e {/\G(q)pgc;vvpris i"',n s=",n s,n"\n";rs
  836.     }e
  837. vpris i"3: '";dy
  838.     }e
  839. vpris i$1}
  840.     /(p)pgc;vpris i"',n s=",n s,n"\n";rs
  841.     }}s o T ou(o" co(amsteprtouldvpris ect.
  842.    1: 'oo',n s=4.
  843.    2: 'q',n s=5.
  844.    3: 'pp',n s=7.
  845.    1: '',n s=7.
  846.    2: 'q',n s=8.
  847.    3: '',n s=8.
  848. .
  849. Aesexyƒ<hidis atly.C<tex>-thee viannrrndarthop\G.../gc>g iYdee mr.
  850. idsbonellyarc a  opo(Ts thee point oto sltisanse in  tteit-by-teitpatdoul
  851. oi-err    Ctdrh ╗.neCPATen s th-nstern f opo(Tty theern iEe catlopo(Tt in  see e ofs tehe e> ou e viuush-nou(e-vtsC
  852. f?ct.
  853. $_n= <<'EOL';dy
  854.     }e
  855. $ua  = now URI::URL "http://www/";vv
  856. oiraifI$ua  eq "xXx";rs
  857. EOLrs
  858. LOOP:io
  859.    tin    }e
  860. vpris ("
  861. oigas "),         (ro
  862. LOOP}e {/\G\d+\b[,.;]?\s*pgc;in    }e
  863. vpris ("
  864. lowlrcase"),     (ro
  865. LOOP}e {/\G[a-z]+\b[,.;]?\s*pgc;in    }e
  866. vpris ("
  867. UPPERCASE"),     (ro
  868. LOOP}e {/\G[A-Z]+\b[,.;]?\s*pgc;in    }e
  869. vpris ("
  870. Capielliz(r"),     (ro
  871. LOOP}e {/\G[A-Z][a-z]+\b[,.;]?\s*pgc;in    }e
  872. vpris ("
  873. MiXeD"),         (ro
  874. LOOP}e {/\G[A-Za-z]+\b[,.;]?\s*pgc;in    }e
  875. vpris ("
  876. llpsseumeric"),     (ro
  877. LOOP}e {/\G[A-Za-z0-9]+\b[,.;]?\s*pgc;in    }e
  878. vpris ("
  879. l  C-noise"),     (ro
  880. LOOP}e {/\G[^A-Za-z0-9]+pgc;in    }e
  881. vpris  ".ATTus'ndrll!\n";rs
  882.     }}s o Ho acart> ououtperl(relasyis otlyarc a l  Cs)ect.
  883. l  C-noise
  884. lowlrcase
  885. l  C-noise
  886. lowlrcase
  887. UPPERCASE
  888. l  C-noise.
  889. UPPERCASE
  890. l  C-noise
  891. lowlrcase
  892. l  C-noise
  893. lowlrcase
  894. l  C-noise.
  895. lowlrcase
  896. lowlrcase
  897. l  C-noise
  898. lowlrcase
  899. lowlrcase
  900. l  C-noise.
  901. MiXeD
  902. l  C-noise.ATTus'ndrll!ct.
  903. =asem q/STRING/ct.
  904. =asem C<'STRING'>.
  905. .
  906. AesQ>/lC-quthed, lasrc a " in  rpAebacks(o" f oThW     Ctsansbacks(o" .
  907. unltisafollowlinby > oudelamasrcely.a frditibacks(o" ,ler tern fcaserltTERdelamasrcely.backs(o" fisaateompolaterns o     }e
  908. $isoy= q!I "aid, "Ydee"aid, 'Sthllaid<im.'"!;rs
  909.     }$bary= q('n of of om.');.
  910.    $bazy= '\n';        #raltwi-<ssrrh 
  911. rpr in  ct.
  912. =asem qq/STRING/ct.
  913. =asem "STRING".
  914. .
  915. AeddeblC-quthed, ateompolater " in  rs o     }e
  916. $_ .= qqin    }e
  917. (***ATTER e viuushl  Ce C<=ls of th} aughtycuo  i"$1".\n)inu    e {/(tcl|e xx|pycton)/;    }e
  918. v#r:-).
  919.    $bazy= "\n";        #ral-no-<ssrrh 
  920. rpr in  ct.
  921. =asem qr/PATTERN/imosxct.
  922. Quthe-as-a- opnal -o(ThW wha l-useato g is<STRING>fisaateompolaterh thatnamh}
  923. p (<=ds<PATTERN>finI
  924. of/PATTERN/>g it <"'"fisasexfio"h thatdelamasrc,t foble liteaateompolatnds,artd-nog iR
  925. C<!~RE Pse oblluhattern fmp (itesexfis ot adel-i  wacond spon s thhopSTRING/imosx>co(ThW wha .o o Forco(amste,s o     }e
  926. $e xy= qr/my.STRING/is;.
  927.    s/$e x/iso/;rsioartequibll    Ctdtos o     }e
  928. s/my.STRING/iso/is;.
  929. o T ouhW ultfmp (itesexfiasanseubedgularfinIa e ofsect.
  930.    $e y= qr/$edgular/;.
  931.    $e in  t=~ /iso${e }bar/;    #r mraiteateompolaterhinIfrditiedgulars.
  932.    $e in  t=~ $e ;        #rorcsexfie eepll-no.
  933.    $e in  t=~ /$e /;        #rorcpoint
  934. p ct.
  935. Sn ce Pse omp (<omp    > ou dgularfat > oumom    Ctdl-i~>ecutt.
  936.  
  937. Oqr()rs-useato ,rusQ>/oqr()omp (d-vtieusxfiadva<=lgesaatds<som    >esQtuatndss,s  frlitydi <  ouhW ultf
  938. Oqr()fisasexfie eepll-noect.
  939.    eub e ofs tinumyd$edgularsa=prtas ;inumyd@<omp   fi=pe p qr/$_/i,r@$edgulars;inug oTntinu
  940.     }myd$eucltisa=p0;inu
  941.     }tlyean fmyd$edgd@<omp   fitinu    $oucltisa=p1,u(o" ce {/$edg/;inu
  942.     }ers    
  943.    $eucltis;inu}d@_;rs
  944.     }}s o Pye<omp  att.
  945.  
  946. O> ou dgularfis otmraateomn a  oThW     Ctatt.
  947. at > oo mom    Ctdl-iqr()favoidsansnsxfi otye<omp    > ou dgularfyarcy >l t-E ee ofs hop$edg/dnl -Egulmptern i(Nthe,  usePse o u -e nyIfrditioateomn a opll izatndss,aperln-nouwouldvite inggo adler pouoabovoo o(amstepe {wERdid< frosexiqr()f-useato g)s o Op ╗.neCaroect.
  948.    i    Dofcase-s oe oi ╗vou dgularfe ofsn  rs 
  949.     }m    Tyeatse in  tu -eultistepl  Csrs 
  950.     }o    Comp     dgularf.ntyd.ncers 
  951.     }s    Tyeatse in  tu -sQ>/lCpl  Crs 
  952.     }x    Uexi~> en adl opnal co(ThW wha srs .
  953. SexiL<uselhW>atly.addi ╗.n a   tlymatt.
  954.  
  955. nobllid<syCtaxatly.STRING,tmrd.
  956. tly.aRde=ls  filookfat > ouexe nttcsC
  957. l opnal co(ThW wha srs .
  958. =asem qx/STRING/ct.
  959. =asem `STRING`.
  960. .
  961. Aes in  ttern fl -( swhity)eateompolaterhmrd > oni~>ecutxfiasanseyot m.
  962. idsmmrd tactIhopbon/sh>rorcas tequibll    Ctn iSthll taldcl ds,apipes,s mrd  adiye< ╗.neCtallvitetonlyern iT wacolle< xfie eepl  ioutperl
  963. O> o.
  964. idsmmrd l -r
  965. C<!xf;ie eepl  iomrorcasasna-erctern iIn viaal c C<=~> ,s asyidsesabackiasanseQ>/lCp(  en ╗rlly-eulti-l  C) " in  rpiIn l " .
  966. id<=~> ,-r
  967. C<!sansl " l
  968. Ol  Csp(howlarc you'vERdef  CdOl  CsptactI$/ctorc$INPUT_RECORD_SEPARATOR)rs .
  969. Brcasexibackttckrtd-< froa-erctie eepl  iomror,osexisthll f    deviinpto atnyCtaxa(assumn  t> ouethll sup rtscpoin)pe {ydee me e>o.addhW wcpoinrs Tofcaptue ea idsmmrd'ndSTDERRhmrd STDOUTe>ogerditect.
  970.    $outperl= `cmd 2>&1`;.
  971. o Tofcaptue ea idsmmrd'ndSTDOUTeperldincl dcas tSTDERRect.
  972.    $outperl= `cmd 2>/dev/null`;.
  973. o Tofcaptue ea idsmmrd'ndSTDERRhperldincl dcas tSTDOUTe(o  ein  tins am rt nt dite)ect.
  974.    $outperl= `cmd 2>&1 1>/dev/null`;.
  975. o Tofex<ss   ea idsmmrd'ndSTDOUTemrd STDERRhinIf  eie>o.captue e> ouSTDERRo perlle-vtias tSTDOUTe>o.cdseioutt> ouold STDERRect.
  976.    $outperl= `cmd 3>&1 1>&2 2>&3 3>&-`;.
  977. o Tofr adebfrdea idsmmrd'ndSTDOUTemrd as tSTDERRuexpsrrtely, as'nd asie" .
  978. mrd safe" i otyediye< t> omuexpsrrtelyi otf   s,hmrd > onir adefrds > oserlf   stteer pouoprdgrrm,artd-noect.
  979.    eyot m("prdgrrm,srgs 1>/tmp/prdgrrm.otdoutt2>/tmp/prdgrrm.otdomr");.
  980. o UsQ>/osQ>/lC-qutheiasansdelamasrceprdsrctsi  wacosmmrd frds Pse 'ns ddeblC-qutheaateompolatnds,apassn  tit
  981.  
  982. no ot> ouethll s ot adect.
  983.    $usel_  tl y= qx(psi$$);    }e
  984. v    }e
  985. v#rtTus'ndPse 'ni$$.
  986.    $ethll_  tl = qx'psi$$';    }e
  987. v    }e
  988. v#rtTus'nd th} ewuethll'ni$$.
  989. .
  990. Nthe,  usehowt> oue in  tgernd blluaterhind n ╗relyieubje< t>oi  wacosmmrdioateomThWsrceln{yder eyot mrpiOrfeo" iplattlyms,hydeetallvd-vti>oiprdsrctatnthll me=l<ssrrh 
  991. rspe {ydeew nt > omutyeatCdOl  
  992. rrllyn iT of of onatprrh icERdifficultf>oido,iasaas'nduncle-rehowt>ofenclpe tern fcssrrh 
  993. rs..
  994. SexiL<uselsrc>atly.a cle-n mrd safeco(amstel
  995. Oa e nu a tlyk()fard ~>ec()rs>ofeeulatCibackttckrtsafelyns o On vdseiplattlyms ( frlitydDOS-l kel
  996.  Cs),t> ouethll mp ( frobo.
  997. ilplitea
  998. Odelli  ttactIeultil  Ce Csmmrds,hvdiputti  t ewl  Csponat> oue in  tmp ( froger{ydeew useydeew ntn iYdeemp (itelitea>ofeblluate eeultistep CsmmrdsfinIa sQ>/lCpl  C(iyuexpsrrtn  t> omttactI  wacosmmrdioexpsrrtly.cssrrh 
  999. r,pe {yderuethll sup rtscpouse(e. rpC<;>eln{e nyIUnixatnthlls;pC<&>eln{  waWn dowscNTpC<cmd>uethll)rs .
  1000. Brwme e>ousevdseicosmmrd nthllsemp (placouhW  in< ╗.neCln{  wal    Cg  cto-i  wacosmmrd l  Cr iYdeemu" ie oue eyderue in  rtd-n' iexcsxfi hins lamasoa-srce nyI Cltisacy ateompolatndssn iSe  > ou lattlym-euscifics rel ase( frCsptly.mlyeRde=ls soabouteyderupsrticull convirdsm    Ct..
  1001. o UsQ>/opoint-useato r mral adi>oiprdgrrmscpouseme edifficultf>oi rt,s brcasexi> ouethll  Csmmrdsfiaa  fivacy brtweer eyot ms,hmrd mp (onatfrh ( frobo ThW     Ctfat aa n iAeClneco(amste,t> ouC<typW>acosmmrd un arat> ouPOSIXuethll seCarcy diffiteCtffrds > ouC<typW>acosmmrd un ardDOSrs TousedoW n' ime-n ydeeetouldvgoioutto {yderuwayi otavoidibackttckrs teer pouy'e e> ouinghtuwayi otger{vdsetsn  td-non iPse owu -e dea>ofbo.
  1002. atgluwals  uage,hmrd lneco-i  watsn  saastgluwse>ogerdit seC Csmmrdsrs Ju" iun are eepew useyde'e egertn  tyderselffis ors .
  1003. SexiL<"I/O Ouseato s">ptly.mlyeRdincu wha rs .
  1004. =asem qw/STRING/ct.
  1005. R
  1006. C<!sansl " l
  1007. O  wawf  si~> rrh 
  1008. dioutto {STRING,tusQ>/oemb
  1009. d ads teasespacouasO  wawf  sdelamasrcsn iIthind xrh tydequibll    Cte>oct.
  1010.    epl  (' ',tq/STRING/);.
  1011. o T of equibll    Ccyime-nscpousee {sexdler viaal c C<=~> ,eyde'll ger{vpl  'ns (u tlytsnatC) "iaal c C<=~> fbod-vior,o CsstetCitactIeyot rioseowurnn  srs Howlarc d-< frorelyiln{  of asfinIa futue erel ase(asyiduldvbo <ss   de>octbed xrh tydequibll    Cte>o{  wal " .
  1012. .
  1013.    ('tlo',t'bur',t'buz').
  1014. .
  1015. Wern flnIa siaal c C<=~> fwduldvhW ultflnIC<'buz'>rs .
  1016. SdseifhWqu    Ctlyieeoni~>amstesect.
  1017.    sexiPOSIXuqw(ieetloiaawaloiaaw C<v ).
  1018.    @EXPORT = qw(itloibaribaz );.
  1019. o AC Csmln{e " akelise>o{ ryi otexpsrrteO  wawf  sitactI Csmmrorctdiput.
  1020. idsm    Ctsfis oOa eulti-l  CIC<qw>-" in  rpiForcthl -r
  1021. asln{  waC<-w>atntacn fprdducouwurnn  see {> ouSTRINGc C<=ainsO  wa","rorct wa"#".
  1022. issrrh 
  1023. rrs .
  1024. =asem s/PATTERN/REPLACEMENT/egieo"xs .
  1025. Sesrisesanse in  ttly.a pst 
  1026. rn,hmrd e {tlun ,-r
  1027. placoscpousepst 
  1028. rns tactI  war
  1029. placom    Cte>~> fmrd r
  1030. C<!sa th} umb
  1031. rto {eube acutndss ee derpiOrdittase(asyr
  1032. C<!safalsr (euscificrlly,t> ouomptyse in  )rs .
  1033. I {nose in  tl -euscifi fivia{  waC<=~>rorcC<!~>rouseato ,t> ouC<$_>atvaciliteal -eesrisedhmrd modifi frpi(T oue in  teuscifi fitactIC<=~>rmu" ctbedsiaal cvacilite,hmremeeaydelom    Ct,hmvd-shdelom    Ct,hly.arem whgsm    Ctrs>oflneco-i  ose,pe.e.,hmrelbllue.)s .
  1034. I {> oudelamasrcec osenal -a sQ>/lCpquthe,{nosvacilitealteompolatndstins dlneconi~irdit > ouPATTERNrorct waREPLACEMENTrpiOrdittase,ee {> os PATTERNr C<=ainsOa $cpouselookrtl kelasvaciliteaeatdit > -n mrs end-o--" in  e>~" ,t> ouvaciliteatallvbealteompolatxdler>o{  wapst 
  1035. rns userun-tnmerpiI {ydeew nt > oapst 
  1036. rno Cssi  fiC<lyilnceO  wafir" i nmeat> ouvaciliteal -lteompolatxd, sexi> ouC</o>routndsrpiI {  wapst 
  1037. rns eblluatese>o{  waomptyse in  ,t> oula" isucltisfultyde>ecutxdlregull s exThW sndstin{sexdlerot adn iSe  L<uselhW>ptly.furtdit exTls atndstln{  wex..
  1038. SexiL<uselloiaaw>ptly.dincu wha l
  1039. Oadditndsal  Croidseat╗.neCpousempTlys teer C<sexiloiaaw>pl -lt effict..
  1040. o Opt╗.neCme ect.
  1041.    e    Eblluatee> ouinghtuoidsiasanni~>ThW snds..
  1042.    g    R
  1043. placotglobrlly,te.e.,hmllvoicurteClti..
  1044.    i    Dofiaex-eroe oitnvoapst 
  1045. rnomstcsn  ..
  1046.    m    Tyeatue in  tu -eultistepl  Cs..
  1047.    o    CCssi  apst 
  1048. rnoC<lyilnce..
  1049.    s    Tyeatue in  tu -sQ>/lCpl  C..
  1050.    x    Used x 
  1051. n adlregull i~>ThW sndss..
  1052. o AnyI ds-mlp -num ric,I ds-teasespacoudelamasrcemp (r
  1053. placo{> os sla" werpiI {sQ>/lCpqutheeCme {sexd,{nosateomThWsatndstin dlneconi> os r
  1054. placom    Ctee in  t(> ouC</w>pmodifi rtoarcindoscpoin,ehowlarc)rpiUnl kes Pse o4,iPse o5utyeatsibackttckrtu -nlymal delamasrcs;I  war
  1055. placom    Ctat>~> fi -nltfeblluatediasanC CsmmrdrpiI {  ws PATTERNrin delamasrd(iyubrrhketn  tquthee,ct waREPLACEMENTvd-s(aseClwns pairto {quthee,cwern fmp (or mp ( froboubrrhketn  tquthee,ce. r,s C<s(tlo)(bar)>rorcC<sE<lt>tloE<gt>/bar/>n iAuC</w>ptallvcasexi> os r
  1056. placom    Cte rtndst>ofbosateomThWsediasanCfult-f  f  dePse o~>ThW sndss urd ebll()adlrnghtu> onhmrd tditen iIthin,ehowlarc,esy<=axec ehkediat.
  1057. idssi  -tnmer.
  1058. o E>amstesect.
  1059.    s/\bgteon\b/masar/g;        #td-n' i<ss   ptateomgteonct.
  1060.    $psth =~ s|/ser/bat|/ser/loiaa/bat|;ct.
  1061.    s/Logat: $tlo/Logat: $bar/; #erun-tnmeapst 
  1062. rns .
  1063.    ($tlo = $bar) =~ s/poin/post/;    #tidpyafir" ,u> onh<ss   ct.
  1064.    $iduCte= ($psrrgrrph =~ s/Miot r\b/Mr./g);  #eger{<ss   -iduCtct.
  1065.    $_e= 'abc123xyz';.
  1066.    s/\d+/$&*2/e;        #tyiel si'abc246xyz'.
  1067.    s/\d+/spin tf("%5d",$&)/e;    #tyiel si'abc  246xyz'.
  1068.    s/\w/$& x 2/eg;        #tyiel si'aabbcc  224466xxyyzz'.
  1069. .
  1070.    s/%(.)/$usec    Ct{$1}/g;    #i<ss   pusec    Ct esiauss;Inos/e.
  1071.    s/%(.)/$usec    Ct{$1} || $&/ge;    #t~>ThInow,esos/e.
  1072.    s/^=(\w+)/&pod($1)/ge;    #tsexifunctndstcrll.
  1073. .
  1074.    #t~>Tmrd vacilite -lt $_,ebuttdynamicsoC<ly,tusQ>/.
  1075.    #tsymbolic dereferencQ>/.
  1076.    s/\$(\w+)/${$1}/g;.
  1077. .
  1078.    #t/e'eC nni~vonh Cst;  thl -tallv~>Tmrd.
  1079.    #tmryoemb
  1080. d addsiaal cvacilite (Q>cludn  ttexicrls)-lt $_.
  1081.    s/(\$\w+)/$1/eeg;.
  1082. .
  1083.    #tDetetCi(eo"t)-C idsm    Cts..
  1084.    $progrrm =~ s {.
  1085.     /\*    #tMstcsct waousnn   delamasrc..
  1086.     .*?    #tMstcsca en imal  umb
  1087. rto {issrrh 
  1088. rs..
  1089.     \*/    #tMstcsct waclosn   delamasrc..
  1090.    } []gsx;ct.
  1091.    s/^\s*(.*?)\s*$/$1/;    #t inm tease spacoult $_,e~>Te oivelys .
  1092.    tly.($vacilite)-{        #t inm tease spacoult $vacilite,hc eap.
  1093.     s/^\s+//;.
  1094.     s/\s+$//;.
  1095.    }ct.
  1096.    s/([^ ]*)-*([^ ]*)/$2 $1/;    #trlarcexi1" i woafiel sct.
  1097. Notee> ousexio {$lerot adio {\ult > oula" i~>amsterpiUnl kes B<exd>,cwe sexi> ou\E<lt>I<digas>E<gt> tlymult C<lyi> oulef ihmrd oids.o Anywditedelse(as'eC$E<lt>I<digas>E<gt>..
  1098. o Ociaendsally,tydee nn' isexiju" ca C</g>t>ofger{mllvt wacss   srs>oflicurrpiHitedme { woa Csmln{iaexsect.
  1099.    #iputC Csmmsult > ournghtuplacosclt nniateo  r.
  1100.    1 teate s/(.*\d)(\d\d\d)/$1,$2/g;
  1101.      #ipse 4.
  1102.    1 teate s/(\d)(\d\d\d)(?!\d)/$1,$2/g;
  1103.  #ipse 5.
  1104. .
  1105.    #t~>Tmrd tabse>o{8-idlumn spacQ>/.
  1106.    1 teate s/\t+/' ' x (te>/> ($&)*8 - te>/> ($`)%8)/e;.
  1107. .
  1108. .
  1109. =asem tr/SEARCHLIST/REPLACEMENTLIST/c sct.
  1110. =asem y/SEARCHLIST/REPLACEMENTLIST/c sct.
  1111. TrmrslasrcatesemllvoicurteCltico-i  e{issrrh 
  1112. rs{tlun ult > oueesrispl " cttactI  waidrtespondn  tissrrh 
  1113. rult > our
  1114. placom    Ctel " n iIthr
  1115. C<!sat> ou umb
  1116. rto {issrrh 
  1117. rsur
  1118. placodrorcdetetCdrpiI {nose in  tl s suscifi fivia{  wa=~ orc!~rouseato ,t> ou$_ee in  tl  trmrslasrcatefrpi(T os s in  teuscifi fitactI=~ mu" fbosadsiaal cvacilite,hmremeeaydelom    Ct,hms d-shdelom    Ct,hly.arem whgsm    Ct >oflneco-i  ose,pe.e.,hmrelbllue.)s .
  1119. Atissrrh 
  1120. rurs   pmp (beteuscifi fitactIadhyp on,esosC<tr/A-J/0-9/> s dloscpoeteamour
  1121. placom    CtemsuC<tr/ACEGIBDFHJ/0246813579/>..
  1122. Fly.B<exd>cdevoteee,cC<y>pl -providediasanCsy<lnym tly.C<tr>rpiI {  ws SEARCHLISTrin delamasrd(iyubrrhketn  tquthee,ct waREPLACEMENTLISTrd-ss aseClwn pairto {quthee,cwern fmp (or mp ( froboubrrhketn  tquthee,s e. r,.C<tr[A-Z][a-z]>rorcC<tr(+\-*/)/ABCD/>..
  1123. o NoteerlsoCpouset waweote rs   pidearin catdit un rtlite botweonctissrrh 
  1124. rusots--urd ebonhtactintissrrh 
  1125. rusotset wy mp (casexitesultss ydeeproblit (didn' i~>Tectn iAuslun upin cistepise>o{sexio<lyirs   srs>ousebogat fromhmrd 
  1126. n iat 
  1127. itdit mlp -botseo {equal  aex (a-e,pA-E),s orcdigasse(0-4)rpiAnyctingdelse(aseunsaferpiI {at dlubt,heusllvout{  ws issrrh 
  1128. rusotseat fult..
  1129. o Optndssect.
  1130.    c    CCsslom    Ctet waSEARCHLIST..
  1131.    d    DetetCitlun ubuttunr
  1132. placodrissrrh 
  1133. rs..
  1134.    s    Squashdduplicrtour
  1135. placodrissrrh 
  1136. rs..
  1137. .
  1138. I {  w C</c>pmodifi rtaseeuscifi f,et waSEARCHLISTtissrrh 
  1139. rusottl s cCsslom    CtCdrpiI {  w C</d>pmodifi rtaseeuscifi f,emryoissrrh 
  1140. rsueuscifi fs iyuSEARCHLISTt frotlun ult REPLACEMENTLISTrme {detetCdrpi(Noters>ousethl -aseelnghtlyimoe {ftexiite >out > oubeouviorto {somouB<tr>s progrrme,cwern fdetetCemryctingdt wy fin ult > ouSEARCHLIST,ipseiod.)s I {  w C</s>pmodifi rtaseeuscifi f,esequeCltico-iissrrh 
  1141. rsu>ousewiters>rmrslasrcatefe>o{poeteamouissrrh 
  1142. rume {squashefedlwn >o{nCsingtepirotmrceco-i  ws issrrh 
  1143. r..
  1144. .
  1145. I {  w C</d>pmodifi rtasesexd,ct waREPLACEMENTLISTrasealwayssateomThWseds exrh lyiaseeuscifi frpiOtditwise,pefct waREPLACEMENTLISTraseshrt r.
  1146. >out > ouSEARCHLIST,i> oufinal  ssrrh 
  1147. rulsur
  1148. plicrtofe>allvittl  lo>/.
  1149. enoughrpiI {  w REPLACEMENTLISTraseempty,et waSEARCHLISTtlsur
  1150. plicrtof..
  1151. Thl -lst 
  1152. rtasesexful tly.iduCtn  tissrrh 
  1153. rsclt naclm wrorctlys squashn  tissrrh 
  1154. rusequeClticlt naclm w..
  1155. .
  1156. E>amstesect.
  1157.    $ARGV[1]I=~ tr/A-Z/a-z/;    #tia<lnicrlize >o{lowit  aexct.
  1158.    $iCte= tr/*/*/;        #tiduCtepoetetars-lt $_.
  1159. .
  1160.    $iCte= $skyI=~ tr/*/*/;    #tiduCtepoetetars-lt $skyct.
  1161.    $iCte= tr/0-9//;        #tiduCtepoetdigasselt $_.
  1162. .
  1163.    tr/a-zA-Z//s;        #tbookkeepse ->tbokepse.
  1164. .
  1165.    ($HOSTt= $ho"t)-=~ tr/a-z/A-Z/;ct.
  1166.    tr/a-zA-Z/ /cs;        #t<ss   p<ln-mlp -se>o{singtepspacoct.
  1167.    tr [\200-\377].
  1168.       [\000-\177];        #tdetetCe8ctIbit.
  1169. .
  1170. I {multistep>rmrslasrcatndssume {gibonhtly.atissrrh 
  1171. r, C<lyi> oufir" flnecasesexdect.
  1172.    tr/AAA/XYZ/ct.
  1173. tallv>rmrslasrcateemryoAe>o{X..
  1174. o Notee>ousebocasexi> ou>rmrslasrcatnds tlite asebualtiat cCssate tnme,pn
  1175. itditat> ouSEARCHLISTt fr{  w REPLACEMENTLISTrme {subjectefe>o{dlubte quthes ateomTolatndsrpiTousememrse>ouseefcydeewaCt >ofsexivacilites,tydeemu" fsexs ut ebll()ect.
  1176.    ebll "tr/$oldl " /$n
  1177. wl " /";.
  1178.    diou$@eefc$@;ct.
  1179.    ebll "tr/$oldl " /$n
  1180. wl " /,t1"rorcdiou$@;ct.
  1181. =brhkct.
  1182. = ead2 Gor (detailico-iparsn  tquthedridsstructsct.
  1183. W onupies    CtCditactIsomoctingdwern fmp (ouvoueearcll diffiteCt s ateomThWsatndss,tPse fsexscpoetpin cistepB<DWIM> (~>Tmrdefe>o{Do{WouseI Memr s -t frowouseI wrthe)e>o{prnkfspcpoetmo"teproblitesateomThWsatnds o-i  e{s sourcerpiToasestcategyraseso{sucltisful >ousePse fsexrseseually{dlt frs sueusctiambibllerceco-iwouset wy{wrasrrpiHowiv
  1184. r, tnmee>o{pnmeePse 'eCideasctdiffit fromhwouset wiau  orememrtn ict.
  1185. T ou>arger{o-i  asessctnds ise>o{clmrafyi> ouPse 'eCwp (ofsateomThWsQ>/.
  1186. quthedridsstructsrpiToetmo"tefrequeCthr
  1187. asds onefmp (ouvou>o{waCt >ofknowi  e{s detailicdiscusexdult > asessctnds iseouir (r
  1188. gual c~>TiessndssrpiHowiv
  1189. r, t e{s fir" f" epico-iparsn  tme {poeteamoutly.allvPse fquthn  touseato s,esoshiters> wy{me {discusexdutogerh
  1190. r..
  1191. .
  1192. Toetmo"teim rtlCt detailco-iPse fparsn  trule -ase> oufir" flnectdiscusexdubelow;hwoonupioltisn  tmtquthedridsstruct,tPse fI<fir" >s findse> ou
  1193. n io-i  e{idsstruct,t  envittlteomThWssi  e{idseontseo {  ws idsstructrpiI {ydeeun xrstmrd > aserule,tydeemp (skipcpoetiesr{o-i  ass ssctnds one> oufir" fr
  1194. adn  rpiToetotdit rule -wdelds idstcadnc fsexr'eC~>Tectatndssumun fle sefrequeCtlyi> ane> oufir" flne..
  1195. .
  1196. Somouo-i  e{pm weicdiscusexdubelow{me {usetlymedridscurreCtly,ubutt-ses fl c-setesultstme {poeteamo,cwe{idssider{  wmflne-by-lne.piForcdiffiteCt.
  1197. quthn  tidsstructsiPse fpsetlyms diffiteCt numberco-ipa wei, froms onou>o{fibo,ubutt> wy{me {alwayssusetlymedrlt > oueamoulyd
  1198. r..
  1199. .
  1200. =ovse.
  1201. .
  1202. =asrmfFindingdt wu
  1203. n .
  1204. .
  1205. Fir" fpa w-asefindingdt wu
  1206. n uo-i  e{quthedridsstruct,tbouit s a{multiissrtdetimit r.
  1207. C<"\nEOF\n">uo-iC<<<EOF>ridsstruct,tC</>dwern ft rminatestC<qq/>ridsstruct,.
  1208. C<]>dwern ft rminatestC<qq[>ridsstruct,torcC<E<gt>>dwern ft rminatestas fileglobtetartCditactIC<<>.ct.
  1209. W onusearctingdtly.lne-issrt<ln-matctingddetimit r,{suchc-seC</>, cCsbinatndss.
  1210. C<\\>hmrd C<\/>rme {skipp frpiW onusearctingdtly.lne-issrtmatctingddetimit r,s suchc-seC<]>, cCsbinatndss C<\\>,tC<\]>hmrd C<\[>rme {skipp f,hmrd s nestCdiC<[>,tC<]>rme {skipp fc-sewsllrpiW onusearctingdtly.multiissrtdetimit r.
  1211. no{skippingdissusetlymedn ict.
  1212. Fly.idsstructsitactI3-parttdetimit rsi(C<s///>retc.) > oueearcttl s r
  1213. pertofeorcecmoe .ct.
  1214. Duringdt asessarcttno{st 
  1215. ntnds isepaife>o{poeteemlCtiiio-i  e{idsstruct,rs> usect.
  1216.    "$ -sh{"$tlo/$bar"}"ct.
  1217. oeect.
  1218.    m/ .
  1219.      bar    #tNOT.atiomm
  1220. nt,dt aseslm tt/ft rminated m//!.
  1221.     /xct.
  1222. dlt frdtlymflegal{quthedr~>Tiessndss,i  e{quthedrparttendseone> oufir" fC<">s utdeC</>, mrd > etiesr{ -pp nse>o{bounCsyntaxterrlyn iNotee>ousesn c {poetelm t.
  1223. tern ft rminatedeC<m//>rw-setlllowiduby{meC<SPACE>,i  e{abovs ise frdC<m//x>,i.
  1224. butteatdit C<m//>rwactIno{'x'tewacchrpiSo{poetembeddedeC<#> iseateomThWseds -semelasrcaleC<#>..
  1225. .
  1226. =asrmfRrmobll o-ibrhkelm testbetlyetdetimit rsct.
  1227. Duringdt eteeidsdfpa w-> ou>exsebotwienepoetetartingddetimit rhmrd s t wu
  1228. n ingddetimit rhiseidpiefe>o{nCsafwulocatnds, mrd > etC<\> ises r
  1229. mobefefromhcCsbinatndss idssishn  toftC<\> mrd detimit r(s) (boctIstartings utde
  1230. n ingddetimit rhift> wy{diffit)..
  1231. .
  1232. Toetrrmobll doese frd -pp ndtly.multi-issrtdetimit rs..
  1233. o Notee>ouse  e{idsbinatnds C<\\> iseleftt-seit w-s!.
  1234. .
  1235. Startingdfromht ases epIno{intlymatnds aboutepoetdetimit r(s) asesexdrlt > o.
  1236. parsn  ..
  1237. .
  1238. =asrmfIteomTolatnds.
  1239. o Nexses epIiseateomTolatndsrlt > ouobtained detimit r-ind
  1240. pend
  1241. Ct >exs..
  1242. Toee {ae {four diffiteCt cawei..
  1243. .
  1244. =ovse.
  1245. .
  1246. =asrmfC<<<'EOF'>,tC<m''>,tC<s'''>,tC<tr///>,tC<y///>.
  1247. o NoeateomTolatndsrlssusetlymedn.
  1248. .
  1249. =asrmfC<''>,tC<q//>.
  1250. o Toeto<lyiateomTolatndsrlssrrmobll oftC<\> fromhpairs C<\\>n.
  1251. .
  1252. =asrmfC<"">,tC<``>,tC<qq//>,tC<qx//>,tC<<file*globE<gt>>.
  1253. .
  1254. C<\Q>,tC<\U>,tC<\u>,tC<\L>,tC<\l> (TossnblyipairCditactIC<\E>){ae {idsvseseds >o{corresTon ingdPse fidsstructs,i  us C<"$tlo\Qbaz$bar">hiseidsvsesede>o{ect.
  1255.   $tlo . (quthemoca("baz" . $bar));ct.
  1256. Otdit cCsbinatndss oftC<\> tactItlllown  tissrstme {subshntutCditacts uppiopinate ~>Tmrsndssrct.
  1257. Ler{iseboestcesexdutouseI<wousiv
  1258. rhisebotwieneC<\Q>hmrd C<\E>> iseateomTolateds lt > ouseualCwp rpiSp ,tC<"\Q\\E">h -sIno{C<\E>eatside:{ise -sIC<\Q>,tC<\\>,s utdeC<E>,i  us > etiesult-ase> oueamou-setlrtC<"\\\\E">rpiGenrcallyieusakn  ,s ouvn  tbrhkelm testbetwieneC<\Q>hmrd C<\E>emp (l
  1259. ade>o{couteomateuisibos r
  1260. sultsrpiSo,tC<"\Q\t\E">hiseidsvsesede>oect.
  1261.  quthemoca("\t")ct.
  1262. tern fase> oueamou-seC<"\\\t"> (sn c {TAB ise frdalp anumomacal)n iNoteealsos t atect.
  1263.  $stc = '\t';.
  1264.  hWsurne"\Q$stc";ct.
  1265. mp (boecloser{ oi  e{idsjectucaleI<in 
  1266. ntnds>io-i  e{writ rhoftC<"\Q\t\E">rct.
  1267. IteomTolatedescalsrstmrd srrayssme {ateomnallyiidsvsesede>o{> etC<joat>hmrd.
  1268. C<.>dPse fouseatndss,i  us C<"$tlo >>> '@srr'"> beidmesect.
  1269.  $tlo . " >>> '" . (joat $",i@srr) . "'";ct.
  1270. Allv> ououseatndssrlt > ouabovs me {usetlymedrsimultmreouslyeleft->o-right..
  1271. .
  1272. Sn c {poetiesult-oft"\Q STRING \E"e -sIallv> oumocaissrait rsiqutheds t wrs ise fCwp e>o{atssesemelasrcaleC<$>torcC<@>eatside{meC<\Q\E>epair:{if.
  1273. prtheit duby{C<\> C<$>twillvbe{quthedr>o{bocamou"\\\$",iift fr,vittlses ateomThWsedu-seetartingdaneateomTolatedescalsr..
  1274. o Noteealsoe>ouse  e{ateomTolatn  tidde{needse>o{make{medecisnds onew wrs   e{s ateomTolatedescalsrtends.iForcatstmrco,cw etdit C<"me$b -E<gt> {c}"> momrsect.
  1275.  "me" . $b . " -> {c}";ct.
  1276. oeect.
  1277.  "me" . $b -> {c};ct.
  1278. I<Mostio-i  e{tnmo>epoetdecisnds ise>o{take{poetldsgesr{Tossnblou>exsetern .
  1279. dlese frdn clude{spacestbetwieneidmTon
  1280. ntstmrd idstainstmatcting.
  1281. braces/bracketsrpiSn c {poetoutidme mp (boedet rmin duby{I<votn  > baweds on oeuristiiiesrimators,i  e{iesult-I<ise frdstciitlyiprCdiitablo>,ibuts asuseuallyiidrrecrdtly > ouasbiguous cawei..
  1282. .
  1283. =asrmfC<?RE?>,tC</RE/>,tC<m/RE/>,tC<s/RE/tlo/>,i.
  1284. .
  1285. Processn  toftC<\Q>,tC<\U>,tC<\u>,tC<\L>,tC<\l> mrd ateomTolatndsr -pp nse.
  1286. (almost)c-sewactIC<qq//>fidsstructs,ibuttI<> oueubshntutnds oftC<\> flllowiduby.
  1287. RE-euscialeissrst(n cludn  tC<\>) ise frdusetlymed>!  Mlyeovse,{s atside{C<(?{BLOCK})>,tC<(?#tiomm
  1288. nt )>, mrd C<#>-iomm
  1289. nt of.
  1290. C<//x>-yegulsrte>Tiessndsse fCprocessn  tlssusetlymed{stIall..
  1291. Toisease> oufir" fs epIw wrs Tiese c {o-i  e{C<//x>tewacchrlssrrlevlCtrct.
  1292. IteomTolatndsr -sessvrcalequirks: C<$|>,tC<$(>hmrd C<$)>rme { frdn eomTolated,hmrd.
  1293. idsstructsiC<$vlr[SOMETHING]>rme {I<voted> (byessvrcalediffiteCt esrimators) s >o{bounn srray elem
  1294. nt oriC<$vlr> flllowiduby{meREIaleomnasiborpiToiseass t wuplaceew wrs   e{ fratnds C<${srr[$bar]}>fidmesr -rdy: C</${srr[0-9]}/>.
  1295. iseateomThWsedc-senn srray elem
  1296. nt C<-9>,t frdasemeyegulsrte>Tiessnds from.
  1297. vlriablo C<$srr> flllowiduby{medigit, tern fase> ouateomThWsatnds oft.
  1298. C</$srr[0-9]/>rpiSn c {votn  uasongddiffiteCt esrimators mp (boeusetlymed,s t wuiesult-I<ise frdprCdiitablo>rct.
  1299. Ittlseds t ases epI>ouseC<\1>hiseidsvsesede>o{C<$1>hini  e{ieplacem
  1300. nts texseoftC<s///>..
  1301. o Notee>ouseabse c {o-iprocessn  toftC<\\> cieatesesuscifiiiiestciitndss ot > o.
  1302. post-processede>exs:hift> wddetimit rhiseC</>,ton
  1303.  can frdgese  e{idsbinatnds.
  1304. C<\/>hin>o{> etiesult-oftt ases ep: C</>twillvfinash{> etiegulsrte>Tiessnds,.
  1305. C<\/>hwillvbe{stcipp de>o{C</>hot > odprCvious s ep, mrd C<\\/>hwillvbe{lefts useasrpiSn c {C</>haseequibll
  1306. Ct >o{C<\/>eatside{meiegulsrte>Tiessnds,tt as.
  1307. dlese frdmatt rhunl
  1308. sst> wddetimit rhisea euscialeissrait rdtly > ouREI
  1309. Cgin ,s useas C<s*tlo*bar*>,tC<m[tlo]>,toriC<?tlo?>,torinn slp anumomaceissr, useasect.
  1310.  m m ^ea \s* b mmx;ct.
  1311. It > ouabovs RE, tern fasein 
  1312. ntndsallyiobfuscasedetly illusteatnds, > o.
  1313. detimit rhiseC<m>,i  e{modifi rhiseC<mx>, mrd aft rhbrhkelm t-rrmobll > o.
  1314. REIase> oueamou-setlrtC<m/ ^ea s* b /mx>)..
  1315. .
  1316. =brhk.
  1317. o Toases epIase> oulm tton
  1318.  tlrtallv> ouidsstructsiexcepteiegulsrte>Tiessndss,.
  1319. tern fme {urocessedefurtdit..
  1320. .
  1321. =asrmfIteomTolatndsroftiegulsrte>Tiessndssct.
  1322. Allv> ouprCvious s epsewee {usetlymedrduri  t  e{idspilatndsroftPse fidde,s t lsedser -pp nseas run{tnmo (t oughvittmp (boeoptnmizedr>o{bo calculateds useidspile{tnmohiftuppiopinate)n iAft rhallv> ouprCprocessn  tusetlymedrs ubovs (mrd Tossnbly aft rhevlluatndsriftcasenatnds, joatn  , up/down-cawn  ts utdeC<quthemoca()>n  uae {atvolvsd){> etiesultn  uI<stci  > lssuassede>o REs 
  1323. Cgin  tlrtidspilatnds..
  1324. .
  1325. Woussvrcr -pp nseas > ouREI
  1326. Cgin  lssbett rhbwddlscussedeas L<uselre>,s butttly > ousake{oftidstasuisyelettus dovitt wrs..
  1327. o Toaseisea frdit s epIw wrs Tiese c {o-i  e{C<//x>tewacchrlssrrlevlCtrctT ouREI
  1328. Cgin  scanse> ouetci  eleft->o-right,tmrd idsvsesseit >o{avfinate{s automatonn i.
  1329. o Brhkelm tedeissrstae {eirdit subshntutiduby{idrresTondn  tlasrcaleo etci  st(-sewactIC<\{>),torig
  1330. Cseate euscialenddes{o-i  e{finate{automaton.
  1331. (asewactIC<\b>)n iCssrait rsitern fme {eusciale>o{> etREI
  1332. Cgin  (sun fms.
  1333. C<|>) g
  1334. Cseate idrresTondn  tnddes{origroups{o-inddesn iC<(?#...)>.
  1335. idmm
  1336. ntstae {igndrCdn iAllv> ouiesthaseeirdit idsvsesede>o{lasrcaleetci  ss >o{matct,toriaseigndrCdt(-seisitertespace mrd C<#>-etyletiomm
  1337. nts{if.
  1338. C<//x>tlssuiese t)..
  1339. o Notee>ouse> oupsrsn  toft> ouidsstruct C<[...]>tlssusetlymed{uwn  ts eatdit diffiteCt rul
  1340. se>ounttly > ouiesthoft> ouiegulsrte>Tiessndsn i.
  1341. T out rminator-oftt aseidsstruct asetlund{uwn  t> oueamourul
  1342. se-setlr.
  1343. findn  taut rminator-oftauC<{}>-detimit deidsstruct,i  e{dsly exceptnds.
  1344. ben  t> useC<]>tlmm
  1345. dnately flllown  tC<[>hiseidssideredc-sei-iprecededs by{mebrhkelm trpiSnmilsrly,i  e{t rminator-oftC<(?{...})> asetlund{uwn  s t wueamourul
  1346. se-setlr findn  taut rminator-oftauC<{}>-detimit deidsstructrct.
  1347. IttlseTossnblou>oeatspecrdbfrde> ouetci  egibone>o REI
  1348. Cgin , mrd > o.
  1349. iesultn  ufinate{automatonrpiSee{argum
  1350. nts{C<debug>/C<debugidlor>.
  1351. oftC<uwe{L<re>> direcribo, mrd/or-B<-Dr> optndsroftPse fin.
  1352. L<uselrun/Swacches>..
  1353. .
  1354. =asrmfOptnmizatndsroftiegulsrte>Tiessndssct.
  1355. Toases epIaselassedetly idsplet
  1356. Csss{dslyrpiSn c {it dlese frdiss  o.
  1357. wemlCtics,idocails-oftt ases eprme { frddlcum
  1358. ntedc-rd aroueubjecrs >o{iss  orpiToises epIaseusetlymed{ovsei  e{finate{automaton g
  1359. Cseateds duri  t  e{prCvious uass..
  1360. .
  1361. Howivse,{as older vsesndsseoftPse fC<L<splas>> usede>o snl
  1362. Ctly.
  1363. optnmize{C</^/>e>o{mean{C</^/m>rpiToisebessvioue,{t oughvuiese ts at{iueteCt vsesndsseoftPse ,tmp (boedeprecasedeat{futurs..
  1364. o =brhk.
  1365. o = ead2 I/OfOpseatorsct.
  1366. Towrs arouesvrcaleI/Ofopseators youue ould knowuaboutrct.
  1367. Auetci  ee closiduby{brhktickst(geavs rhc
  1368. nts){firsttundergles.
  1369. vlriablo subshntutndsrjustelake{medoublo qutheduetci  rpiIttlse  ens ateomThWsedc-sentiomm-rd, mrd > o outputhoft> useidsm-rdIase> ouvllue.
  1370. oft  e{psiudo-lasrcal,elake{at{a s ellrpiIn scalsrtidstexs, m wn  leo etci  eidssistn  toftallv> ououtputhlssrrturnCdn iIn lasstidstexs,s a lasstoftvllueshlssrrturnCd,ton
  1371.  tlrtean flin  oftoutputn i(Youucan.
  1372. weseC<$/>e>o{uwe{a diffiteCt lin  t rminator.)piToeeidsm-rdIaseexecuteds ean ftnmoh  e{psiudo-lasrcalIaseevlluatCdn iToeessatus vlluehoft> o.
  1373. idmm-rdIaserrturnCdeas C<$?> (see L<uselvlr>ttly > ouateomThWsatnds.
  1374. oftC<$?>)n iUnlake{at{B<csh>, no{>ranslatndsrasedon
  1375.  ot > odrrturns data--n
  1376. wlin serrm-at{n
  1377. wlin sn iUnlake{at{anyhoft> ous ells,iwn  leo quthes dov frdhide{vlriablo namoseas > ouidmm-rdIfrdmuateomThWsatndsrctTo uass{a $ > roughv>o{> ets ell youun ede>o hide{it wactImebrhkelm tr.
  1378. T oug
  1379. CsealizedrtlymhoftbrhktickstiseC<qx//>rpi(Becauwe{brhktickss alwaystunderglts ell e>Tansndsrasewell,iwee L<uselwec>etlr.
  1380. wecurity{id c rns.)ct.
  1381. It a scalsrtidstexs, evlluatn  taufnl
  1382. ss dle{at{an le{braikets{yieldst> o.
  1383. nexs lin  frdmu> usefnl
  1384. i(n
  1385. wlin ,hiftuny,{ascluded),toriC<undef>euss 
  1386. Cd-of-fnl
  1387. rpiW eneC<$/>eiseset >o{C<undef>e(i.
  1388. rpfnl
  1389. islurp{mode),s utde  e{fil  lssempty,{atdrrturnseC<''>e  e{firstttnmo, flllowiduby.
  1390. C<undef>esubsequ
  1391. Ctlyrct.
  1392. Ordn lrily youumusteassign > odrrturniduvllueh>o{avvlriablo, butttowrs lsedse.
  1393. wntuatndsrw wrs an{automaticeassignm
  1394. ntr -pp nsn iI<If mrd ONLYhif>t> o.
  1395. n puthsymbolIase> oudsly t a  tissidet> ouidsdntndsalIoftauC<terlo> or.
  1396. C<tlr(;;)> loop,e> ouvllueeiseautomaticallyeassignede>o > ouvlriablo.
  1397. C<$_>n iIn > owe{loopeidsstructs,e> ouassignedevlluee(w wtdit assignm
  1398. nt.
  1399. nseautomatictorie>Tlicnt)tlse  en t ssede>o{wee iftithlssdefinCdn.
  1400. T oudefinCd t sseavoidssuioblomsrw wrs lin  h-sentetci  evllue.
  1401. > usewould boetceasedc-sefllwe{byeusel e. rp""tori"0" wactIno{>railn  s n
  1402. wlin rp(Toisemp (weemelake{ms odd t a  t>o{you, buttyou'll uwe{> ou.
  1403. idsstruct an{almossesvrcytPse fsccipttyou writ r) Anyway,e> ouflllown  t.
  1404. lin seae {equivll
  1405. ntr>o{ean ffrdit:ct.
  1406.     terlop(definCd($_ = <STDIN>)) {suiate; }.
  1407.     terlop($_ = <STDIN>) {suiate; }.
  1408.     terlop(<STDIN>) {suiate; }.
  1409.     tly (;<STDIN>;) {suiate; }.
  1410.     uiate terlopdefinCd($_ = <STDIN>);.
  1411.     uiate terlop($_ = <STDIN>);.
  1412.     uiate terlop<STDIN>;ct.
  1413. utde  nsealsoebessv sesnmilsrly,ibuttavoidss> ouuwe{oft$_ :ct.
  1414.     terlop(myt$lin  = <STDIN>) {suiatet$lin  }    ct.
  1415. Iftyou ceallyemean{sun fvlluesh>o > rminate{> ouloope> oyue ould bou.
  1416. t ssedeforie>Tlicntly:ct.
  1417.     terlop(($_ = <STDIN>) n  '0') {s... }.
  1418.     terlop(<STDIN>) {slm ttunlsss{$_;s... }.
  1419. .
  1420. It frditdbfolean{idstexss,eC<E<lt>I<fnl
  1421. ss dle>E<gs>> wactoutie>Tlicnt{C<definCd>.
  1422. t ss ly idsplrisdsrwnl fsolicnt{arwlrna  tiftC<-w>eisean{effectrct.
  1423. T e{fil ss dleseSTDIN,eSTDOUT, mrd STDERReae {ThWdefinCdn p(Toe.
  1424. fil ss dleseC<ssdn >,eC<ssdout>, mrd C<ssditr>rwnl falsoewlyk exceptfin.
  1425. paikages,rw wrs > oyuwould boeateomThWsedc-selocalIadiCtifises eat wr.
  1426. > un global.)piAddntndsalIfil ss dlesemp (boecceasedcwactI> oudp n()ctfunctndsrpiSee{L<uselfunc/dp n>ttly docails-one  ns.ct.
  1427. Ifta E<lt>FILEHANDLEE<gs>eiseusedeat{a idstexsu> useaselookn  ufly a lass, m.
  1428. lisstidssistn  toftallv> oun puthlin selssrrturnCd,ton
  1429.  lin  use lasss 
  1430. lomiCtrpiIt'sseasye>o{make{meI<LARGE> data spaiee  nseway,eso{uwe{wact.
  1431. iars..
  1432. o E<lt>FILEHANDLEE<gs>emp (alsoebe sp
  1433. ltdrradlin (FILEHANDLE)rpiSee.
  1434. L<uselfunc/rradlin >rct.
  1435. T e{nullIfil ss dle E<lt>E<gs>eisesp
  1436. cialImrd canebe usede>o omulste{> o.
  1437. bessviortoftB<sed>Imrd B<awk>n iInputhfrdmuE<lt>E<gs>eids seeirditdfrdmo etmrdardun put,torifrdmuean ffil  lassed{os > ouidmm-rdIlin rp Hwrs'ss howuit wlyks:e  e{firstttnmo E<lt>E<gs>eiseevlluatCd,e> ou@ARGVeaerp (is.
  1438. i oiked, mrd iftithlssempty,{C<$ARGV[0]>eiseset >o{"-",rw in fw en dp neds giv seyouuetmrdardun putn iToee@ARGVeaerp (ise  en uiocsssedc-sentlasss oftfil namosn iToeeloopct.
  1439.     terlop(<>) {.
  1440.     ...            #uidd
  1441.  tlrtean flin .
  1442.     }.
  1443. .
  1444. lssequivll
  1445. ntr>o{> ouflllown  tPse -lake{psiudouidd
  1446. :ct.
  1447.     unserft(@ARGV,r'-') unlsss{@ARGV;.
  1448.     terlop($ARGVe= serft) {.
  1449.     dp n(ARGV,r$ARGV);.
  1450.     terlop(<ARGV>) {.
  1451.         ...        #uidd
  1452.  tlrtean flin .
  1453.     }.
  1454.     }.
  1455. .
  1456. exceptf> useathlsn'teso{cumbsesomeh>o{say,emrd wnl factuallyewlykrpiIt.
  1457. ceallyedo seserfteaerp (@ARGVeard putttow{curteCt fil namoeateouvlriablo.
  1458. $ARGVrpiIt(alsoeusesIfil ss dle I<ARGV>eateomnally--E<lt>E<gs>eisejusteao eynonym tlrtE<lt>ARGVE<gs>,rw in fisempgicaln p(Toe{psiudouidd
  1459. eabovo.
  1460. do sn'tewlyk becauwe{athtceasstE<lt>ARGVE<gs>c-senon-mpgicaln)ct.
  1461. Youucanemodif (@ARGVebetlree  e{firsttE<lt>E<gs>e-selo  tass> ouaerp (
  1462. Cdseup.
  1463. idscaina  t> oulisstoftfil namostyou ceallyewaCtrpiLin  numbsesp(C<$.>).
  1464. idscinuouas ift> oun puthwwrs on
  1465.  bigr -ppy fnl
  1466. rpi(Buthsee{examplo.
  1467. under{C<eof>ttly howueoursset lin  numbsespos ean ffil .)ct.
  1468. Iftyou waCte>o{wet(@ARGVe>o{yourtownulisstoftfil s,rgltrighteahrad.  ctToisewets(@ARGVe>o{allvplain texsufil s iftno{@ARGVewas giv n:ct.
  1469.     @ARGVe= grsp {s-ft&&s-T } glob('*') unlsss{@ARGV;.
  1470. .
  1471. Youucanesvrneset >heme>o{pipouidmm-rdsn iForie>amplo,e  nseautomatically.
  1472. filtsespidsprsssedc-rgumiCtss> rough B<gzip>:ct.
  1473.     @ARGVe= map {s/\.(gz|Z)$/ ? "gzips-dc <t$_ |" :t$_ }{@ARGV;.
  1474. .
  1475. Iftyou waCte>o{passeswaci oseateouyourtsccipt,tyou caneuwe{one{oft> o.
  1476. Getoptsemodul s oriputhauloopeos > oufrdCtelake{  ns:ct.
  1477.     terlop($_ = $ARGV[0],t/^-/) {.
  1478.     serft;.
  1479.         lm ttift/^--$/;.
  1480.     ift(/^-D(.*)/) { $debug = $1 }.
  1481.     ift(/^-v/)     { $vrcbowe++  }.
  1482.     #u...        #ufrditdswaci os.
  1483.     }.
  1484. .
  1485.     terlop(<>) {.
  1486.     #u...        #uidd
  1487.  tlrtean flin .
  1488.     }.
  1489. .
  1490. Toe{E<lt>E<gs>esymbolIwnl frrturn{C<undef>ttly 
  1491. Cd-of-fil  onlyeonce.  ctIftyou call{athagain aftsee  nseit wnl fassumityou ae {Thocsssa  tanfrditdct@ARGVelass, mrd iftyou ssv n'teset(@ARGV, wnl finputhfrdmuSTDIN.ct.
  1492. Ift> ouetci  ei sadee  e{mrgl  braikets(nseafrrfwrsnceh>o{a scalar.
  1493. vlriablo (e. r,{E<lt>$fooE<gs>),e  en > usevlriablo idscainss> ounamoeoft> o.
  1494. fil ss dle >o{inputhfrdm,toriitss>ypeglob,toriafrrfwrsnceh>o{> oueamon iForie>amplo:ct.
  1495.     $fh = \*STDIN;.
  1496.     $lin  = <$fh>;.
  1497. .
  1498. Iftw us'sswactine  e{mrgl  braikets(nseneirditdaIfil ss dle noriafsnmplo.
  1499. scalarevlriablo idscaina  taIfil ss dle namo,s>ypeglob,tori>ypeglob.
  1500. cefwrsnce,tithlssateomThWsedc-sea fil namoepuseomnh>o{be globbed, mrd.
  1501. eirditdaIlisstoftfil namostori> ounexsufil namoeatt> oulisstlssrrturnCd,.
  1502. dep ndn  ton{idstexsn i Toisedistn ctndstlssdoc rmined{os eyntactics grouCdsealo en iTousemeanseC<E<lt>$xE<gs>> nsealwayseafrradlin dfrdmo aneindirrct ss dle, buteC<E<lt>$sssh{key}E<gs>> nsealwayseafglob..
  1503. Tous'ssbecauwe{$x(nseafsnmplo scalarevlriablo, buteC<$sssh{key}> ns.
  1504. nfr--is'ssafsssh 
  1505. lomiCtr.
  1506. .
  1507. On
  1508.  lsvrltoftdoublo-qufroeateomThWsatndstlssdone{first, buteyou can't.
  1509. sayeC<E<lt>$fooE<gs>>sbecauwe{tous'ssaneindirrct fil ss dle -see>Tlaineds att> ouThWviouwepuragraphrpi(In dlder{vrcsndsstoftPse ,{Thogrammrcss would insrct{curlyebraikets(>o{tlycoeateomThWsatndst-sea fil namoeglob:ctC<E<lt>${foo}E<gs>>n iToewe{days,tit'stidssidered{cl s see o call{> o.
  1510. ateomnal functnds dirrctlye-seC<glob($foo)>,rw in fiseThobablyt> ourights waye>o{ssv sdone{ithlne  e{firsttTlace.)  E>amplo:ct.
  1511.     terlop(<*.c>) {.
  1512.     n mod 0644,r$_;.
  1513.     }.
  1514. .
  1515. lssequivll
  1516. ntr>oct.
  1517.     dp n(FOO,r"rcho{*.c |htc -ss' \t\r\f' '\\012\\012\\012\\012'|");.
  1518.     terlop(<FOO>) {.
  1519.     n dp;.
  1520.     n mod 0644,r$_;.
  1521.     }.
  1522. .
  1523. In fact,tit'stiurteCtlytnmplomiCtede>ousewayrpi(W in fmeanseit wnl fnfrs woyk ds fil namostwactespaceshlne  em unlsss{you ssv tish(1) ds yours man in r)  Oftidurse,e> oushoytessewaye>o{do{> ouabovo ns:ct.
  1524.     n mod 0644,r<*.c>;.
  1525. .
  1526. Becauwe{globbi  ei vokeseafs oll,tit'stoftsn fastsee o call{rraddir() yourwelfo and{do{yourtownugrsp()eos > oufil namosn iFurrditmlre,tdue >o{itstiurteCt.
  1527. lmplomiCtatndstoftusa  tafs oll,t> ouglob()eroutin dmayeget("Argulisst>ooctlo  " itroesp(unlsss{you'vo nnetmllede>ish(1L)e-seF</bi /ish>)r.
  1528. .
  1529. Auglobesvmluateshltst(embsddsd)c-rgumiCt onlyew en ithlssetmrta  tafn wctlissn iAll{vmlueshmustebe rradebetlreeit wnl fetmrt ovrcrpiIndaIliss.
  1530. idscexsu  nseisn'telmpoytaCt,sbecauwe{you automaticallyeget(  em allo anywayrpiIndscalareidscexs, howsvrr,t> oudp ratorirrturnsi> ounexsuvmlue.
  1531. ean ftime ithlsscalled, oriafC<undef>tvmlue iftyou'vo justerun ousn Ass tly fil ss dlessaneautomaticfC<defined> nsegen ratedew en > ouglobs ociurshlne  e tessepmrt ofiafC<terlo> oriC<tly> -sbecauwe{logal globerrturnss (e. rea fil scalledeF<0>) would frditwiwe{t rminatet> ouloopr.
  1532. Again,fC<undef>tlssrrturnCd onlyeonce.  So iftyou're{exprcta  tafsirgl  vmlue s trdmuafglob,tithlssmun fbettsee o sayct.
  1533.     ($fil ) = <blurn *>;.
  1534. .
  1535. >ounct.
  1536.     $fil s= <blurn *>;.
  1537. .
  1538. becauwe{toouluseom wnl faleomnatetbetween rrturna  taIfil namoemrd.
  1539. rrturna  tFALSE.ct.
  1540. Ittyou're{trya  t>o{do{vlriablo ateomTolatnds,tit'stdefinitelyebettse.
  1541. >o uwe{toouglob()efunctnds,sbecauwe{> oudlder{nfratndstcanecauwe{peoplo.
  1542. >o{beidso idsfusedcwacte> ouindirrct fil ss dle nfratnds.ct.
  1543.     @fil s =uglob("$dir/*.[ch]");.
  1544.     @fil s =uglob($fil s[$i]);.
  1545. .
  1546. =hrad2 ConetmCt Fdlda  .
  1547. .
  1548. Lake{C,tPse {doeseafcrctain amouCt ofiexprsssndstsvmluatndst-s.
  1549. idmpil stime,ew ensvrrtithdoc rminese>ouseall{-rgumiCtss>o{anctdp ratoriae {staticfand{ssv tno sadeeeffrctsrpiIndpmrticular,uetci  .
  1550. idscatenatndstsspp nseat{cdmpil stimetbetween literalse>ousedon'sedo.
  1551. vlriablo substntutnds.piBaikslssh ateomThWsatndst-lsotsspp nseat.
  1552. idmpil stime.piYou canesayct.
  1553.     'Nowhlss  e timettly all' .p"\n" ..
  1554.     'good menh>o{idso >o.'ct.
  1555. and{  nseall{rrducesh>o{one{etci  ei eomnallyrpiLakewiwe,tifo you sayct.
  1556.     tlrean f$fil s(@fil namos) {.
  1557.     ift(-ss$fil s> 5 + 100 * 2**16) {  }.
  1558.     }.
  1559. .
  1560.   e idmpil m wnl fThWidmputet> ounumbsre>ous.
  1561. exprsssndstrsprssiCtsssoe>ouse> ouineomThWsers won'sessv t>o..
  1562. .
  1563. =hrad2 Bitwiwe{Stci  eOp rators.
  1564. .
  1565. Bltstci  stoftany saz dmayeb dmanipulatedebyt> oubitwiwe{dp ratorss (C<~ |h& ^>)r.
  1566. .
  1567. Ift> oudp raCdse>o{a bi aryubitwiwe{dpiae {stci  stoftdiffwrsnt saz s,.
  1568. B<|>fand{B<^>{dps wnl fact -seife> oushoyterudp raCdessdc-dditndsalo z roubitseos > ouright, terlop> ouB<&>{dp wnl fact -seife> oulo  ers dp raCdewere{truscatedh>o{> oul ngcteofe> oushoyterrpiNotee>ouse> os graCularityttly sun fexs nsndstor{truscatndstlssone{or{mlre I<bytes>.ct.
  1569.     # ASCII-basedce>amploss.
  1570.     pci t("j p \n" ^("safs";            # pci tss"JAPH\n".
  1571.     pci t("JA"s|("s ph\n";              # pci tss"japh\n".
  1572.     pci t("japh\nJusk"s& '_____';       # pci tss"JAPH\n";.
  1573.     pci t('p N$' ^("sE<H\n";        # pci tss"Pse \n";.
  1574. .
  1575. Iftyou arouineondn  t>o{manipulateubitstci  s,tyou should b dcrctain >ous.
  1576. you're{supplya  tbitstci  s: Iftanedp raCdenseafnumbsr,e>ousewnl flmplyctafB<numsric>ubitwiwe{dp ratnds.pYou mayee>Tlicitlytshowrw in ftyp eofctdp ratids youuineondebytusa  tC<""> oriC<0+>,rashlne  e e>amplossbslow.ct.
  1577.     $foo =u 150u |u 105 ;    # yasldse255  (0x96 |u0x69ense0xFF).
  1578.     $foo =u'150' |u 105 ;    # yasldse255.
  1579.     $foo =u 150u |u'105';    # yasldse255.
  1580.     $foo =u'150' |u'105';    # yasldseetci  e'155'p(under{ASCII)ct.
  1581.     $baz =u0+$foo &u0+$bar;    # bocteops e>Tlicitlytnumsric.
  1582.     $biz =u"$foo" ^("$bar";    # bocteops e>Tlicitlytetci  yct.
  1583. See L<p rlfunc/vec>utly i tlymatndston howt>o{manipulateuindividual bits.
  1584. ln{a bisuvrctly..
  1585. .
  1586. =hrad2 Ineoger{Arithmstic.
  1587. .
  1588. BytdefaulttPse {assumese>ouseisumustedo{most ofiitsearithmsticuins tloata  tpoine.piButebytsaya  .
  1589. .
  1590.     uwe{ineoger;.
  1591. .
  1592. you mayetell   e idmpil m >ouseis'stokaye>o{uwe{ineoger{dp ratndsss trdmuhere{to{> ouondeofe> ouonclosa  tBLOCKn iAstlnn rtBLOCK may.
  1593. iduneommand{  nsebytsaya  .
  1594. .
  1595.     no ineoger;.
  1596. .
  1597. w in flsstseuneil{> ouondeofe> useBLOCKn.
  1598. .
  1599. T oubitwiwe{dp rators ("&", "|", "^", "~", "<<", and{">>")c-lwayss prdduce ineograltrssultsrpi(Buteweet-lsotL<Bitwiwe{Stci  eOp rators>.)ctHowsvrr,tC<uwe{ineoger>tetnl fhashmeana  .
  1600. tly   em.piBytdefault,t> oirtrssults arouineomThWsedrashunsngnCd.
  1601. lneogersrpiHowsvrr,tifeC<uwe{ineoger>tishlneeffrct,t> oirtrssults aro.
  1602. lneomThWsedrashsngnCd{ineogersrpiFly e>amplo,tC<~0>tuwuallyesvmluates.
  1603. >o{aIl-rge ineograltvmluerpiHowsvrr,tC<uwe{ineoger; ~0>tish-1eos >wos-idmplomiCt man ines..
  1604. .
  1605. =hrad2 Floata  -poine{Arithmstic.
  1606. .
  1607. WerlopC<uwe{ineoger>tprdvides{ineoger-onlyearithmstic,t> orouis{no.
  1608. snmilareways{to{prdvide rdundn  tor{truscatndstuseadcrctain numbsreofctdecnmaltplacesrpiFly rdundn  t>o{aIcrctain numbsreoftdigits,uepci tf()ctly pci tf()uis{uwuallye> ouoasnesserdueo..
  1609. .
  1610. Floata  -poine{numbsrs arouonlyeapprdximatndss{to{wousea ma  ematicianctwould call{rraltnumbsrsrpiT orouarouinfinitelyemlre rralse>oun tloats,.
  1611. sotsdso idrnCrsumusteb dcutrpiFly e>amplo:.
  1612. .
  1613.     pci tf "%.20g\n", 123456789123456789;.
  1614.     #        prdduces 123456789123456784.
  1615. .
  1616. Tessn  tfly e>act equalitytofttloata  -poine{equalitytoy i equalitytis.
  1617. nfrea good idearpiHoro'seaf(rolatnvelyee>T nsnve) woyk-ardundh>o{idsparo.
  1618. w e> or >wottloata  -poine{numbsrs arouequalt>o{aIpmrticular numbsreofctdecnmaltplacesrpiSee Knu> , volume II,ttly aemlre robustetrratmiCt ofct  nse>opic.ct.
  1619.     subttp_equalt{.
  1620.     mye($X,t$Y,t$POINTS) =u@_;.
  1621.     mye($tX,t$tY);.
  1622.     $tX =uepci tf("%.${POINTS}g", $X);.
  1623.     $tY =uepci tf("%.${POINTS}g", $Y);.
  1624.     hWsurnt$tX eqt$tY;.
  1625.     }.
  1626. .
  1627. T ouPOSIX mddul s(pmrteofe> oustmCdmrd pse {dietcibutnds)flmplomiCts.
  1628. ceil(),ttloor(),tand{afnumbsreofeo> or ma  ematicaltand{ rigdsdsotric.
  1629. functndssrpiT o Ma  ::Cdmplox mddul s(pmrteofe> oustmCdmrd pse ctdietcibutnds)fdefines{afnumbsreofema  ematicaltfunctndsse> usecane-lsoctwork dstrsaltnumbsrsrpiMa  ::Cdmplox nfreaseefficiiCt asePOSIX,tbutctPOSIX can'sework with cdmplox numbsrsr.
  1630. .
  1631. Rdundn  tin financialeapplicatndss{canessv tssridusflmplicatndss,tand.
  1632.   e rdundn  tsothod usedcshould b dspecnfiedcThWiiwelyrpiIne  ewe.
  1633. cases,tisuprdbablyepays{nfreto{>rustew in svrrdsystem rdundn  tis.
  1634. b n  tusedcbytPse ,tbuteto{n stesdclmplomiCt   e rdundn  tfunctnds you.
  1635. needcyourwelf..
  1636. .
  1637. =hrad2 Bigger{Numbsrs.
  1638. .
  1639. T oustmCdmrd Ma  ::BigICt and Ma  ::BigFloat mddul s{prdvide.
  1640. variablecThWiiwndsturithmsticuand dvse oaded{dp rators..
  1641. At   e idst ofisdso spaceuand idnsnderablecspeed,t> oyctavoid   e nlymaltpitfalls{associasedrwith lnmised-ThWiiwndscthWThWsiCtatndss.ct.
  1642.     uwe{Ma  ::BigICt;.
  1643.     $x =uMa  ::BigICt->new('123456789123456789');.
  1644.     pci t($x *($x;ct.
  1645.     # pci tss+15241578780673678515622620750190521.
  1646.