diff options
author | Ricardo Signes <rjbs@semiotic.systems> | 2020-08-23 21:30:06 -0400 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-09-06 20:47:53 -0600 |
commit | 391047546324e06cdf7e65c820d385f5c5c1baa0 (patch) | |
tree | 8b7dbff0516499a2121e537eef0e66eb1caba96e /pod/perltie.pod | |
parent | eb0444cb23a8ec47ef18d5aa33ec88aa5e71b7e8 (diff) | |
download | perl-391047546324e06cdf7e65c820d385f5c5c1baa0.tar.gz |
language docs: prefer postfix deref in numerous places
Diffstat (limited to 'pod/perltie.pod')
-rw-r--r-- | pod/perltie.pod | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/pod/perltie.pod b/pod/perltie.pod index 1bb220691b..6f870597c6 100644 --- a/pod/perltie.pod +++ b/pod/perltie.pod @@ -316,7 +316,7 @@ object I<this>. (Equivalent to C<scalar(@array)>). For example: sub FETCHSIZE { my $self = shift; - return scalar @{$self->{ARRAY}}; + return scalar $self->{ARRAY}->@*; } =item STORESIZE this, count @@ -429,7 +429,7 @@ Remove last element of the array and return it. For example: sub POP { my $self = shift; - return pop @{$self->{ARRAY}}; + return pop $self->{ARRAY}->@*; } =item SHIFT this @@ -440,7 +440,7 @@ and return it. For example: sub SHIFT { my $self = shift; - return shift @{$self->{ARRAY}}; + return shift $self->{ARRAY}->@*; } =item UNSHIFT this, LIST @@ -454,8 +454,8 @@ up to make room. For example: my @list = @_; my $size = scalar( @list ); # make room for our list - @{$self->{ARRAY}}[ $size .. $#{$self->{ARRAY}} + $size ] - = @{$self->{ARRAY}}; + $self->{ARRAY}[ $size .. $self->{ARRAY}->$#* + $size ]->@* + = $self->{ARRAY}->@* $self->STORE( $_, $list[$_] ) foreach 0 .. $#list; } @@ -484,7 +484,7 @@ In our example, we'll use a little shortcut if there is a I<LIST>: tie @list, __PACKAGE__, $self->{ELEMSIZE}; @list = @_; } - return splice @{$self->{ARRAY}}, $offset, $length, @list; + return splice $self->{ARRAY}->@*, $offset, $length, @list; } =item UNTIE this @@ -754,7 +754,7 @@ dangerous thing that they'll have to set CLOBBER to something higher than croak "@{[&whowasi]}: won't remove all dot files for $self->{USER}" unless $self->{CLOBBER} > 1; my $dot; - foreach $dot ( keys %{$self->{LIST}}) { + foreach $dot ( keys $self->{LIST}->%* ) { $self->DELETE($dot); } } @@ -782,8 +782,8 @@ to iterate through the hash, such as via a keys(), values(), or each() call. sub FIRSTKEY { carp &whowasi if $DEBUG; my $self = shift; - my $a = keys %{$self->{LIST}}; # reset each() iterator - each %{$self->{LIST}} + my $a = keys $self->{LIST}->%*; # reset each() iterator + each $self->{LIST}->%* } FIRSTKEY is always called in scalar context and it should just @@ -808,7 +808,7 @@ thing, but we'll have to go through the LIST field indirectly. sub NEXTKEY { carp &whowasi if $DEBUG; my $self = shift; - return each %{ $self->{LIST} } + return each $self->{LIST}->%* } =item SCALAR this @@ -835,7 +835,7 @@ referenced by C<$self-E<gt>{LIST}>: sub SCALAR { carp &whowasi if $DEBUG; my $self = shift; - return scalar %{ $self->{LIST} } + return scalar $self->{LIST}->%* } NOTE: In perl 5.25 the behavior of scalar %hash on an untied hash changed |