X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlop.pod;h=483a686ebb65be5be867b08ace232fdb4f027711;hb=a2bdc9a53b6d7221bdf979c28003d54de36d16e5;hp=13655a7d9c8207a308ce6e774b948a1d1625e141;hpb=cb1a09d0194fed9b905df7b04a4bc031d354609d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlop.pod b/pod/perlop.pod index 13655a7..483a686 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -8,7 +8,8 @@ Perl operators have the following associativity and precedence, 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 -> @@ -31,7 +32,7 @@ Perl easier for C folks.) right = += -= *= etc. left , => nonassoc list operators (rightward) - left not + right not left and left or xor @@ -88,7 +89,7 @@ well as subroutine and method calls, and the anonymous constructors C<[]> and C<{}>. See also L toward the end of this section, -as well as L. +as well as L<"I/O Operators">. =head2 The Arrow Operator @@ -157,7 +158,7 @@ thing from interpretation. =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 @@ -383,7 +384,7 @@ As a list operator: @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'); @@ -561,7 +562,6 @@ are interpolated, as are the following sequences: \n newline \r return \f form feed - \v vertical tab, whatever that is \b backspace \a alarm (bell) \e escape @@ -960,10 +960,10 @@ list consisting of all the input lines is returned, one line per list element. It's easy to make a I data space this way, so use with care. -The null filehandle <> is special and can be used to emulate the -behavior of B and B. Input from <> comes either from +The null filehandle EE is special and can be used to emulate the +behavior of B and B. Input from EE 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 EE 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 @@ -984,11 +984,11 @@ is equivalent to the following Perl-like pseudo code: 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 internally--<> is just a synonym +$ARGV. It also uses filehandle I internally--EE is just a synonym for , which is magical. (The pseudo code above doesn't work because it treats as non-magical.) -You can modify @ARGV before the first <> as long as the array ends up +You can modify @ARGV before the first EE 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.) @@ -1008,7 +1008,7 @@ Getopts modules or put a loop on the front like this: ... # code for each line } -The <> symbol will return FALSE only once. If you call it again after +The EE 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. @@ -1027,7 +1027,7 @@ $ interpretation is done first, but you can't say C$fooE> 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${foo}E>. -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, which is probably the right way to have done it in the first place.) Example: