This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
perldata: remove duplicate text from adjacent sections
[perl5.git]
/
pod
/
perldata.pod
diff --git
a/pod/perldata.pod
b/pod/perldata.pod
index
a79ca65
..
03191b5
100644
(file)
--- a/
pod/perldata.pod
+++ b/
pod/perldata.pod
@@
-668,7
+668,8
@@
of how to arrange for an output ordering.
=head2 Subscripts
=head2 Subscripts
-An array is subscripted by specifying a dollar sign (C<$>), then the
+An array can be accessed one scalar at a
+time by specifying a dollar sign (C<$>), then the
name of the array (without the leading C<@>), then the subscript inside
square brackets. For example:
name of the array (without the leading C<@>), then the subscript inside
square brackets. For example:
@@
-692,15
+693,12
@@
are used. For example:
print "Darwin's First Name is ", $scientists{"Darwin"}, "\n";
print "Darwin's First Name is ", $scientists{"Darwin"}, "\n";
-=head2 Slices
-X<slice> X<array, slice> X<hash, slice>
+You can also subscript a list to get a single element from it:
-A common way to access an array or a hash is one scalar element at a
-time. You can also subscript a list to get a single element from it.
+ $dir = (getpwnam("daemon"))[7];
- $whoami = $ENV{"USER"}; # one element from the hash
- $parent = $ISA[0]; # one element from the array
- $dir = (getpwnam("daemon"))[7]; # likewise, but with list
+=head2 Slices
+X<slice> X<array, slice> X<hash, slice>
A slice accesses several elements of a list, an array, or a hash
simultaneously using a list of subscripts. It's more convenient
A slice accesses several elements of a list, an array, or a hash
simultaneously using a list of subscripts. It's more convenient