diff options
author | reneeb <github@renee-baecker.de> | 2016-04-27 16:00:02 +0200 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2016-04-30 15:04:54 -0400 |
commit | 10d36cf9c1885126580478a10462ed672361059e (patch) | |
tree | e053354283eb52a89ce67a1b932802046b6422d8 /pod | |
parent | 1a8aefec218b12053a0d3589cae2c353c1360887 (diff) | |
download | perl-10d36cf9c1885126580478a10462ed672361059e.tar.gz |
perllol: remove docs about the removed autoderef feature
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perllol.pod | 41 | ||||
-rw-r--r-- | pod/perlref.pod | 7 |
2 files changed, 1 insertions, 47 deletions
diff --git a/pod/perllol.pod b/pod/perllol.pod index 7eee1ec9a1..b3defad78f 100644 --- a/pod/perllol.pod +++ b/pod/perllol.pod @@ -170,45 +170,6 @@ to do something a bit funnier looking: # add new columns to an existing row push @{ $AoA[0] }, "wilma", "betty"; # explicit deref -Prior to Perl 5.14, this wouldn't even compile: - - push $AoA[0], "wilma", "betty"; # implicit deref - -How come? Because once upon a time, the argument to push() had to be a -real array, not just a reference to one. That's no longer true. In fact, -the line marked "implicit deref" above works just fine--in this -instance--to do what the one that says explicit deref did. - -The reason I said "in this instance" is because that I<only> works -because C<$AoA[0]> already held an array reference. If you try that on an -undefined variable, you'll take an exception. That's because the implicit -derefererence will never autovivify an undefined variable the way C<@{ }> -always will: - - my $aref = undef; - push $aref, qw(some more values); # WRONG! - push @$aref, qw(a few more); # ok - -If you want to take advantage of this new implicit dereferencing behavior, -go right ahead: it makes code easier on the eye and wrist. Just understand -that older releases will choke on it during compilation. Whenever you make -use of something that works only in some given release of Perl and later, -but not earlier, you should place a prominent - - use v5.14; # needed for implicit deref of array refs by array ops - -directive at the top of the file that needs it. That way when somebody -tries to run the new code under an old perl, rather than getting an error like - - Type of arg 1 to push must be array (not array element) at /tmp/a - line 8, near ""betty";" - Execution of /tmp/a aborted due to compilation errors. - -they'll be politely informed that - - Perl v5.14.0 required--this is only v5.12.3, stopped at /tmp/a line 1. - BEGIN failed--compilation aborted at /tmp/a line 1. - =head2 Access and Printing Now it's time to print your data structure out. How @@ -291,7 +252,7 @@ parsable Perl code. For example: [ "george", "jane", "elroy" ], [ "homer", "marge", "bart" ], ); - push $AoA[0], "wilma", "betty"; + push @{ $AoA[0] }, "wilma", "betty"; show @AoA; will print out: diff --git a/pod/perlref.pod b/pod/perlref.pod index e64abe4360..8959ba5554 100644 --- a/pod/perlref.pod +++ b/pod/perlref.pod @@ -51,13 +51,6 @@ When a scalar is holding a reference, it always behaves as a simple scalar. It doesn't magically start being an array or hash or subroutine; you have to tell it explicitly to do so, by dereferencing it. -That said, be aware that Perl version 5.14 introduces an exception -to the rule, for syntactic convenience. Experimental array and hash container -function behavior allows array and hash references to be handled by Perl as -if they had been explicitly syntactically dereferenced. See -L<perl5140delta/"Syntactical Enhancements"> -and L<perlfunc> for details. - =head2 Making References X<reference, creation> X<referencing> |