Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: how to push 5th element from one array to another array

by gmargo (Hermit)
on Oct 27, 2009 at 20:14 UTC ( #803510=note: print w/replies, xml ) Need Help??


in reply to how to push 5th element from one array to another array

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";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://803510]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-12-01 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?