listed from highest precedence to lowest. Note that all operators
borrowed from C keep the same precedence relationship with each other,
even where C's precedence is slightly screwy. (This makes learning
-Perl easier for C folks.)
+Perl easier for C folks.) With very few exceptions, these all
+operate on scalar values only, not array values.
left terms and list operators (leftward)
left ->
right = += -= *= etc.
left , =>
nonassoc list operators (rightward)
- left not
+ right not
left and
left or xor
constructors C<[]> and C<{}>.
See also L<Quote and Quotelike Operators> toward the end of this section,
-as well as L<I/O Operators>.
+as well as L<"I/O Operators">.
=head2 The Arrow Operator
=head2 Binding Operators
-Binary "=~" binds an expression to a pattern match. Certain operations
+Binary "=~" binds a scalar expression to a pattern match. Certain operations
search or modify the string $_ by default. This operator makes that kind
of operation work on some other string. The right argument is a search
pattern, substitution, or translation. The left argument is what is
@foo = @foo[$#foo-4 .. $#foo]; # slice last 5 items
The range operator (in a list context) makes use of the magical
-autoincrement algorithm if the operaands are strings. You
+autoincrement algorithm if the operands are strings. You
can say
@alphabet = ('A' .. 'Z');
\n newline
\r return
\f form feed
- \v vertical tab, whatever that is
\b backspace
\a alarm (bell)
\e escape
element. It's easy to make a I<LARGE> data space this way, so use with
care.
-The null filehandle <> is special and can be used to emulate the
-behavior of B<sed> and B<awk>. Input from <> comes either from
+The null filehandle E<lt>E<gt> is special and can be used to emulate the
+behavior of B<sed> and B<awk>. Input from E<lt>E<gt> comes either from
standard input, or from each file listed on the command line. Here's
-how it works: the first time <> is evaluated, the @ARGV array is
+how it works: the first time E<lt>E<gt> is evaluated, the @ARGV array is
checked, and if it is null, C<$ARGV[0]> is set to "-", which when opened
gives you standard input. The @ARGV array is then processed as a list
of filenames. The loop
except that it isn't so cumbersome to say, and will actually work. It
really does shift array @ARGV and put the current filename into variable
-$ARGV. It also uses filehandle I<ARGV> internally--<> is just a synonym
+$ARGV. It also uses filehandle I<ARGV> internally--E<lt>E<gt> is just a synonym
for <ARGV>, which is magical. (The pseudo code above doesn't work
because it treats <ARGV> as non-magical.)
-You can modify @ARGV before the first <> as long as the array ends up
+You can modify @ARGV before the first E<lt>E<gt> as long as the array ends up
containing the list of filenames you really want. Line numbers (C<$.>)
continue as if the input were one big happy file. (But see example
under eof() for how to reset line numbers on each file.)
... # code for each line
}
-The <> symbol will return FALSE only once. If you call it again after
+The E<lt>E<gt> symbol will return FALSE only once. If you call it again after
this it will assume you are processing another @ARGV list, and if you
haven't set @ARGV, will input from STDIN.
because that's an indirect filehandle as explained in the previous
paragraph. In older version of Perl, programmers would insert curly
brackets to force interpretation as a filename glob: C<E<lt>${foo}E<gt>>.
-These days, it's consdired cleaner to call the internal function directly
+These days, it's considered cleaner to call the internal function directly
as C<glob($foo)>, which is probably the right way to have done it in the
first place.) Example: