Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Skipping Elements in an Array

by vladdrak (Monk)
on Apr 07, 2005 at 08:34 UTC ( #445574=note: print w/replies, xml ) Need Help??


in reply to Skipping Elements in an Array

You could do this:
#!/usr/bin/perl use strict; use Data::Dumper; my @Array = ('AAA','BB','CCCC','DD','EEEEE','FFF','GGGG'); my $num_of_skip =2; for (my $i; $i <= $#Array; $i++) { if (length $Array[$i] == $num_of_skip) { $i=$i+2; } else { print "$Array[$i]\n"; } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2023-02-07 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (40 votes). Check out past polls.

    Notices?