Homework?
You just need a simple loop.
my @myarray = qw(1 2 3 4 5 6 7 8 sd frd sed sddfsd asecf ssdd myh); my @fifth; for (my $i=4; $i < scalar(@myarray); $i += 5) { push(@fifth, $myarray[$i]); } print "fifth=".join(",",@fifth)."\n";
In reply to Re: how to push 5th element from one array to another array
by gmargo
in thread how to push 5th element from one array to another array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |