diff options
author | Scott Baker <scott@perturb.org> | 2023-01-23 16:04:01 -0800 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-01-24 14:01:41 +0800 |
commit | fa1fe46855cd623ff0f787f3025c3c3f14cd57b4 (patch) | |
tree | 60b9216eb4e8982f61b58abc62a9f1119d702542 /pod/perlfunc.pod | |
parent | 71724c058dddcd30d3a4024c98c91f4dabb493d0 (diff) | |
download | perl-fa1fe46855cd623ff0f787f3025c3c3f14cd57b4.tar.gz |
Put the example after the explanation
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r-- | pod/perlfunc.pod | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 1c885489b7..83d4fb6103 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -9762,8 +9762,7 @@ X<unshift> =for Pod::Functions prepend more elements to the beginning of a list Add one or more elements to the B<beginning> of an array. This is the -opposite of a L<C<shift>|/shift ARRAY>. Returns the new number of elements -in the updated array. +opposite of a L<C<shift>|/shift ARRAY>. my @animals = ("cat"); unshift(@animals, "mouse"); # ("mouse", "cat") @@ -9771,8 +9770,11 @@ in the updated array. my @colors = ("red"); unshift(@colors, ("blue", "green"); # ("blue", "green", "red") +Returns the new number of elements in the updated array. + # Return value is the number of items in the updated array my $color_count = unshift(@colors, ("yellow", "purple"); + say "There are $color_count colors in the updated array"; Note the LIST is prepended whole, not one element at a time, so the |