scope. In Perl v5.14 and earlier, C<continue> required the C<"switch">
feature, like the other keywords.
-C<evalbytes> is only available with with the C<"evalbytes"> feature (see
+C<evalbytes> is only available with the C<"evalbytes"> feature (see
L<feature>) or if prefixed with C<CORE::>. C<__SUB__> is only available
-with with the C<"current_sub"> feature or if prefixed with C<CORE::>. Both
+with the C<"current_sub"> feature or if prefixed with C<CORE::>. Both
the C<"evalbytes"> and C<"current_sub"> features are enabled automatically
with a C<use v5.16> (or higher) declaration in the current scope.
print "Text\n" if -T _;
print "Binary\n" if -B _;
-As of Perl 5.9.1, as a form of purely syntactic sugar, you can stack file
+As of Perl 5.10.0, as a form of purely syntactic sugar, you can stack file
test operators, in a way that C<-f -w -x $file> is equivalent to
C<-x $file && -w _ && -f _>. (This is only fancy fancy: if you use
the return value of C<-f $file> as an argument to another filetest
is used. Because a C<bless> is often the last thing in a constructor,
it returns the reference for convenience. Always use the two-argument
version if a derived class might inherit the function doing the blessing.
-SeeL<perlobj> for more about the blessing (and blessings) of objects.
+See L<perlobj> for more about the blessing (and blessings) of objects.
Consider always blessing objects in CLASSNAMEs that are mixed case.
Namespaces with all lowercase names are considered reserved for
subroutine happens to have been deleted from the symbol table.
C<$hasargs> is true if a new instance of C<@_> was set up for the frame.
C<$hints> and C<$bitmask> contain pragmatic hints that the caller was
-compiled with. The C<$hints> and C<$bitmask> values are subject to change
-between versions of Perl, and are not meant for external use.
+compiled with. C<$hints> corresponds to C<$^H>, and C<$bitmask>
+corresponds to C<${^WARNING_BITS}>. The
+C<$hints> and C<$bitmask> values are subject
+to change between versions of Perl, and are not meant for external use.
C<$hinthash> is a reference to a hash containing the value of C<%^H> when the
caller was compiled, or C<undef> if C<%^H> was empty. Do not modify the values
=item do SUBROUTINE(LIST)
X<do>
-This form of subroutine call is deprecated. SUBROUTINE can be a bareword,
-a scalar variable or a subroutine beginning with C<&>.
+This form of subroutine call is deprecated. SUBROUTINE can be a bareword
+or scalar variable.
=item do EXPR
X<do>
it tried to run a program named I<"echo surprise">, didn't find it, and set
C<$?> to a non-zero value indicating failure.
-Beginning with v5.6.0, Perl attempts to flush all files opened for
-output before the exec, but this may not be supported on some platforms
-(see L<perlport>). To be safe, you may need to set C<$|> ($AUTOFLUSH
-in English) or call the C<autoflush()> method of C<IO::Handle> on any
-open handles to avoid lost output.
+Perl attempts to flush all files opened for output before the exec,
+but this may not be supported on some platforms (see L<perlport>).
+To be safe, you may need to set C<$|> ($AUTOFLUSH in English) or
+call the C<autoflush()> method of C<IO::Handle> on any open handles
+to avoid lost output.
Note that C<exec> will not call your C<END> blocks, nor will it invoke
C<DESTROY> methods on your objects.
example, using copy-on-write technology on data pages), making it the
dominant paradigm for multitasking over the last few decades.
-Beginning with v5.6.0, Perl attempts to flush all files opened for
+Perl attempts to flush all files opened for
output before forking the child process, but this may not be supported
on some platforms (see L<perlport>). To be safe, you may need to set
C<$|> ($AUTOFLUSH in English) or call the C<autoflush()> method of
@many = glob "{apple,tomato,cherry}={green,yellow,red}";
-Beginning with v5.6.0, this operator is implemented using the standard
+This operator is implemented using the standard
C<File::Glob> extension. See L<File::Glob> for details, including
C<bsd_glob> which does not treat whitespace as a pattern separator.
Unlike in the shell, if SIGNAL is negative, it kills process groups instead
of processes. That means you usually
want to use positive not negative signals.
-You may also use a signal name in quotes.
+
+You may also use a signal name in quotes. A negative signal name is the
+same as a negative signal number, killing process groups instead of processes.
+For example, C<kill -KILL, $pgrp> will send C<SIGKILL> to the entire process
+group specified.
The behavior of kill when a I<PROCESS> number is zero or negative depends on
the operating system. For example, on POSIX-conforming systems, zero will
-signal the current process group and -1 will signal all processes.
+signal the current process group, -1 will signal all processes, and any
+other negative PROCESS number will act as a negative signal number and
+kill the entire process group specified.
+
+If both the SIGNAL and the PROCESS are negative, the results are undefined.
+A warning may be produced in a future version.
See L<perlipc/"Signals"> for more details.
to the temporary file first. You will need to seek() to do the
reading.
-Since v5.8.0, Perl has built using PerlIO by default. Unless you've
+Perl is built using PerlIO by default; Unless you've
changed this (such as building Perl with C<Configure -Uuseperlio>), you can
open filehandles directly to Perl scalars via:
See L<perlipc/"Safe Pipe Opens"> for more examples of this.
-Beginning with v5.6.0, Perl will attempt to flush all files opened for
+Perl will attempt to flush all files opened for
output before any operation that may do a fork, but this may not be
supported on some platforms (see L<perlport>). To be safe, you may need
to set C<$|> ($AUTOFLUSH in English) or call the C<autoflush()> method
=for Pod::Functions +5.6.0 declare and assign a package variable (lexical scoping)
-C<our> associates a simple name with a package variable in the current
-package for use within the current scope. When C<use strict 'vars'> is in
-effect, C<our> lets you use declared global variables without qualifying
-them with package names, within the lexical scope of the C<our> declaration.
-In this way C<our> differs from C<use vars>, which is package-scoped.
+C<our> makes a lexical alias to a package variable of the same name in the current
+package for use within the current lexical scope.
+
+C<our> has the same scoping rules as C<my> or C<state>, but C<our> only
+declares an alias, whereas C<my> or C<state> both declare a variable name and
+allocate storage for that name within the current scope.
-Unlike C<my> or C<state>, which allocates storage for a variable and
-associates a simple name with that storage for use within the current
-scope, C<our> associates a simple name with a package (read: global)
-variable in the current package, for use within the current lexical scope.
-In other words, C<our> has the same scoping rules as C<my> or C<state>, but
-does not necessarily create a variable.
+This means that when C<use strict 'vars'> is in effect, C<our> lets you use
+a package variable without qualifying it with the package name, but only within
+the lexical scope of the C<our> declaration. In this way, C<our> differs from
+C<use vars>, which allows a the use of an unqualified name I<only> within the
+affected package.
If more than one value is listed, the list must be placed
in parentheses.
our $foo;
our($bar, $baz);
-An C<our> declaration declares a global variable that will be visible
+An C<our> declaration declares an alias for a package variable that will be visible
across its entire lexical scope, even across package boundaries. The
package in which the variable is entered is determined at the point
of the declaration, not at the point of use. This means the following
=item *
-Starting with Perl 5.9.2, integer and floating-point formats, along with
+Starting with Perl 5.10.0, integer and floating-point formats, along with
the C<p> and C<P> formats and C<()> groups, may all be followed by the
C<< > >> or C<< < >> endianness modifiers to respectively enforce big-
or little-endian byte-order. These modifiers are especially useful
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir($dh);
closedir $dh;
-As of Perl 5.11.2 you can use a bare C<readdir> in a C<while> loop,
+As of Perl 5.12 you can use a bare C<readdir> in a C<while> loop,
which will set C<$_> on every iteration.
opendir(my $dh, $some_dir) || die;
into more fields than necessary. Thus, when assigning to a list,
if LIMIT is omitted (or zero), then LIMIT is treated as though it
were one larger than the number of variables in the list; for the
-following, LIMIT is implicitly 4:
+following, LIMIT is implicitly 3:
- ($login, $passwd, $remainder) = split(/:/);
+ ($login, $passwd) = split(/:/);
Note that splitting an EXPR that evaluates to the empty string always
produces zero fields, regardless of the LIMIT specified.
use 5.014; # so srand returns the seed
If C<srand()> is not called explicitly, it is called implicitly without a
-parameter at the first use of the C<rand> operator. However, this was not true
-of versions of Perl before 5.004, so if your script will run under older
-Perl versions, it should call C<srand>; otherwise most programs won't call
-C<srand()> at all.
-
-But there are a few situations in recent Perls where programs are likely to
+parameter at the first use of the C<rand> operator.
+However, there are a few situations where programs are likely to
want to call C<srand>. One is for generating predictable results, generally for
testing or debugging. There, you use C<srand($seed)>, with the same C<$seed>
each time. Another case is that you may want to call C<srand()>
produce the same results as C<srand(42.1)>. To be safe, always pass
C<srand> an integer.
-In versions of Perl prior to 5.004 the default seed was just the
-current C<time>. This isn't a particularly good seed, so many old
-programs supply their own seed value (often C<time ^ $$> or C<time ^
-($$ + ($$ << 15))>), but that isn't necessary any more.
-
-Frequently called programs (like CGI scripts) that simply use
-
- time ^ $$
-
-for a seed can fall prey to the mathematical property that
-
- a^b == (a+1)^(b+1)
-
-one-third of the time. So don't do that.
-
A typical use of the returned seed is for a test program which has too many
combinations to test comprehensively in the time available to it each run. It
can test a random subset each time, and should there be a failure, log the seed
it is split into words and passed directly to C<execvp>, which is
more efficient.
-Beginning with v5.6.0, Perl will attempt to flush all files opened for
+Perl will attempt to flush all files opened for
output before any operation that may do a fork, but this may not be
supported on some platforms (see L<perlport>). To be safe, you may need
to set C<$|> ($AUTOFLUSH in English) or call the C<autoflush()> method
version as defined by the C<feature> pragma, disabling any features
not in the requested version's feature bundle. See L<feature>.
Similarly, if the specified Perl version is greater than or equal to
-5.11.0, strictures are enabled lexically as
+5.12.0, strictures are enabled lexically as
with C<use strict>. Any explicit use of
C<use strict> or C<no strict> overrides C<use VERSION>, even if it comes
before it. In both cases, the F<feature.pm> and F<strict.pm> files are
$atime = $mtime = time;
utime $atime, $mtime, @ARGV;
-Since Perl 5.7.2, if the first two elements of the list are C<undef>,
+Since Perl 5.8.0, if the first two elements of the list are C<undef>,
the utime(2) syscall from your C library is called with a null second
argument. On most systems, this will set the file's access and
modification times to the current time (i.e., equivalent to the example