How do I get a slice from an array reference?
Posted
by Sachin
on Stack Overflow
See other posts from Stack Overflow
or by Sachin
Published on 2010-04-23T16:36:35Z
Indexed on
2010/04/23
21:23 UTC
Read the original article
Hit count: 241
perl
Let us say that we have following array:
my @arr=('Jan','Feb','Mar','Apr');
my @arr2=@arr[0..2];
How can we do the same thing if we have array reference like below:
my $arr_ref=['Jan','Feb','Mar','Apr'];
my $arr_ref2; # How can we do something similar to @arr[0..2]; using $arr_ref ?
© Stack Overflow or respective owner